diff --git a/components/contacts/contact-form.tsx b/components/contacts/contact-form.tsx index bf1c89f2..a49f23c9 100644 --- a/components/contacts/contact-form.tsx +++ b/components/contacts/contact-form.tsx @@ -911,7 +911,6 @@ function CategoryComboBox({ }) { const [isOpen, setIsOpen] = useState(false); const [inputValue, setInputValue] = useState(""); - const wrapperRef = useRef(null); const inputRef = useRef(null); // Parse current keywords from comma-separated string @@ -946,17 +945,6 @@ function CategoryComboBox({ onChange(next); }, [currentKeywords, onChange]); - // Close dropdown on outside click - useEffect(() => { - if (!isOpen) return; - const handler = (e: MouseEvent) => { - if (wrapperRef.current && !wrapperRef.current.contains(e.target as Node)) { - setIsOpen(false); - } - }; - document.addEventListener("mousedown", handler); - return () => document.removeEventListener("mousedown", handler); - }, [isOpen]); const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter") { @@ -970,7 +958,7 @@ function CategoryComboBox({ }; return ( -
+
{/* Keyword badges */} {currentKeywords.length > 0 && (
@@ -998,6 +986,7 @@ function CategoryComboBox({ value={inputValue} onChange={(e) => { setInputValue(e.target.value); setIsOpen(true); }} onFocus={() => setIsOpen(true)} + onBlur={() => setIsOpen(false)} onKeyDown={handleKeyDown} placeholder={currentKeywords.length === 0 ? placeholder : ""} /> @@ -1005,7 +994,7 @@ function CategoryComboBox({ {/* Dropdown */} {isOpen && (suggestions.length > 0 || canAddNew) && ( -
+
e.preventDefault()}> {suggestions.map(kw => (