diff --git a/web/src/components/context_menus/ConnectableNodes.tsx b/web/src/components/context_menus/ConnectableNodes.tsx index c622a42a..8d26c03d 100644 --- a/web/src/components/context_menus/ConnectableNodes.tsx +++ b/web/src/components/context_menus/ConnectableNodes.tsx @@ -1,5 +1,5 @@ /** @jsxImportSource @emotion/react */ -import React, { memo, useCallback, useState, useRef } from "react"; +import React, { memo, useCallback, useState, useRef, useEffect } from "react"; import { Menu, MenuItem, @@ -164,6 +164,15 @@ const ConnectableNodes: React.FC = ({ const [isFocused, setIsFocused] = useState(false); const focusedNodeRef = useRef(null); const currentHoveredNodeRef = useRef(null); + const searchInputRef = useRef(null); + + useEffect(() => { + if (isVisible) { + setTimeout(() => { + searchInputRef.current?.focus(); + }, 100); + } + }, [isVisible]); const filteredNodes = searchTerm ? searchNodesHelper(connectableNodes, searchTerm) @@ -271,6 +280,7 @@ const ConnectableNodes: React.FC = ({ = ({ value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} onClick={(e) => e.stopPropagation()} - autoFocus onKeyDown={(e) => { if (e.key === "Escape") { hideMenu();