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]fixed lossing focus of cell name input on context menu (#6175)
tetsugo025e2324566aec
diff --git a/frontend/src/components/editor/cell/cell-context-menu.tsx b/frontend/src/components/editor/cell/cell-context-menu.tsxindex 700c0c0e6e..fbca79fdc5 100644--- a/frontend/src/components/editor/cell/cell-context-menu.tsx+++ b/frontend/src/components/editor/cell/cell-context-menu.tsx@@ -17,6 +17,7 @@ import {ContextMenuSeparator,ContextMenuTrigger,} from "@/components/ui/context-menu";+import { menuItemVariants } from "@/components/ui/menu-items";import { Tooltip } from "@/components/ui/tooltip";import { toast } from "@/components/ui/use-toast";import { useCellData, useCellRuntime } from "@/core/cells/cells";@@ -219,19 +220,40 @@ export const CellActionsContextMenu = ({}return (- <ContextMenuItem- key={action.label}- className={action.disabled ? "opacity-50!" : ""}- onSelect={(evt) => {- if (action.disableClick || action.disabled) {- return;- }- action.handle(evt);- }}- variant={action.variant}- >- {body}- </ContextMenuItem>+ <Fragment key={action.label}>+ {+ // Set disableClick items such as cell name input+ // to div to prevent roving focus+ action.disableClick ? (+ <div+ className={menuItemVariants({+ className: action.disabled ? "opacity-50!" : "",+ variant: action.variant,+ })}+ onKeyDown={(evt) => {+ evt.stopPropagation();+ }}+ // Prevent keydown propagation, that focus does not jump to shortcut which start with same letter+ // e.g. input "C", then focus jump to "Copy"+ >+ {body}+ </div>+ ) : (+ <ContextMenuItem+ className={action.disabled ? "opacity-50!" : ""}+ onSelect={(evt) => {+ if (action.disableClick || action.disabled) {+ return;+ }+ action.handle(evt);+ }}+ variant={action.variant}+ >+ {body}+ </ContextMenuItem>+ )+ }+ </Fragment>);})}{i < allActions.length - 1 && <ContextMenuSeparator />}