A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: fix focus element on hidden cells (#2942)
Myles Scolnick756b29e066cb
diff --git a/frontend/src/components/editor/SortableCell.tsx b/frontend/src/components/editor/SortableCell.tsxindex b7d563c927..3d4383f0c5 100644--- a/frontend/src/components/editor/SortableCell.tsx+++ b/frontend/src/components/editor/SortableCell.tsx@@ -72,7 +72,11 @@ const SortableCellInternal = React.forwardRef(ref={mergedRef}{...props}data-is-dragging={isDragging}- className={cn(props.className, isMoving && "is-moving")}+ className={cn(+ props.className,+ isMoving && "is-moving",+ "outline-offset-4 outline-primary/40 rounded-lg",+ )}style={style}><DragHandleSlot.Provider value={dragHandle}>diff --git a/frontend/src/core/cells/scrollCellIntoView.ts b/frontend/src/core/cells/scrollCellIntoView.tsindex a085faf07c..ba3c5707b8 100644--- a/frontend/src/core/cells/scrollCellIntoView.ts+++ b/frontend/src/core/cells/scrollCellIntoView.ts@@ -31,7 +31,9 @@ export function focusAndScrollCellIntoView({// If the cell's code is hidden, just focus the cell and not the editor.if (config.hide_code) {- element.focus();+ // Focus the parent element, as this is the one with the event handlers.+ // https://github.com/marimo-team/marimo/issues/2940+ element.parentElement?.focus();} else {const editor = cell.current?.editorView;if (!editor) {diff --git a/frontend/src/core/codemirror/cells/extensions.ts b/frontend/src/core/codemirror/cells/extensions.tsindex 52c07e3e4f..1f36d57f78 100644--- a/frontend/src/core/codemirror/cells/extensions.ts+++ b/frontend/src/core/codemirror/cells/extensions.ts@@ -227,7 +227,10 @@ export function cellMovementBundle(if (isHidden) {ev.contentDOM.blur();// Focus on the parent element- document.getElementById(HTMLCellId.create(cellId))?.focus();+ // https://github.com/marimo-team/marimo/issues/2941+ document+ .getElementById(HTMLCellId.create(cellId))+ ?.parentElement?.focus();} else {ev.contentDOM.focus();}