From df1071ce73b7c838d4c590277556c80e54e97053 Mon Sep 17 00:00:00 2001 From: stroblme Date: Sun, 1 Nov 2026 11:17:18 +0100 Subject: [PATCH] Message suggestions stay open when an empty field is clicked: the field's own focus no longer counts as outside the list --- frontend/src/components/Flow/NodePanel.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/components/Flow/NodePanel.tsx b/frontend/src/components/Flow/NodePanel.tsx index 7537ca4..8b4b895 100644 --- a/frontend/src/components/Flow/NodePanel.tsx +++ b/frontend/src/components/Flow/NodePanel.tsx @@ -156,6 +156,7 @@ function SuggestInput({ onChange: (next: string) => void } & Omit, "value" | "onChange">) { const [open, setOpen] = useState(false) + const input = useRef(null) const matches = suggestions.filter( (item) => item !== value && item.toLowerCase().includes(value.toLowerCase()), @@ -168,6 +169,7 @@ function SuggestInput({ value={value} autoComplete="off" {...props} + ref={input} onFocus={(event) => { setOpen(true) onFocus?.(event) @@ -189,6 +191,12 @@ function SuggestInput({ align="start" className="w-[var(--radix-popover-trigger-width)] p-0" onOpenAutoFocus={(event) => event.preventDefault()} + // The field is outside the list. Focusing it opens the list, and the + // same focus event then reaches the list's outside check, which would + // close it again at once. Its own blur closes it instead. + onInteractOutside={(event) => { + if (event.target === input.current) event.preventDefault() + }} >