diff --git a/packages/react/src/components/tool-tree.tsx b/packages/react/src/components/tool-tree.tsx index 9467ddd8e..f0fa20e6f 100644 --- a/packages/react/src/components/tool-tree.tsx +++ b/packages/react/src/components/tool-tree.tsx @@ -352,8 +352,20 @@ export function ToolTree(props: { // Keyboard shortcuts — `/` focuses search, Escape clears useEffect(() => { + const isEditing = (el: Element | null) => + el instanceof HTMLElement && + (el.isContentEditable || + el.tagName === "INPUT" || + el.tagName === "TEXTAREA" || + el.tagName === "SELECT"); const handler = (e: KeyboardEvent) => { - if (e.key === "/" && document.activeElement?.tagName !== "INPUT") { + if ( + e.key === "/" && + !e.metaKey && + !e.ctrlKey && + !e.altKey && + !isEditing(document.activeElement) + ) { e.preventDefault(); searchRef.current?.focus(); }