diff --git a/frontend/src/components/MobileEventForm.jsx b/frontend/src/components/MobileEventForm.jsx index 6948aea..e2eb0cb 100644 --- a/frontend/src/components/MobileEventForm.jsx +++ b/frontend/src/components/MobileEventForm.jsx @@ -74,26 +74,22 @@ function TimeInputMobile({ value, onChange }) { const [inputVal, setInputVal] = useState(fmt12(value)); const wrapRef = useRef(null); const listRef = useRef(null); - const inputRef = useRef(null); useEffect(() => { setInputVal(fmt12(value)); }, [value]); - // Programmatically disable autocomplete after mount - useEffect(() => { - if (inputRef.current) { - inputRef.current.setAttribute('autocomplete', 'off'); - inputRef.current.setAttribute('autocorrect', 'off'); - inputRef.current.setAttribute('autocapitalize', 'off'); - inputRef.current.setAttribute('spellcheck', 'false'); - } - }, []); - useEffect(() => { if (!open || !listRef.current) return; const idx = TIME_SLOTS.findIndex(s => s.value === value); if (idx >= 0) listRef.current.scrollTop = idx * 40 - 40; }, [open, value]); + useEffect(() => { + if (!open) return; + const h = e => { if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false); }; + document.addEventListener('mousedown', h); + return () => document.removeEventListener('mousedown', h); + }, [open]); + const commit = (raw) => { const parsed = parseTypedTime(raw); if (parsed) { onChange(parsed); setInputVal(fmt12(parsed)); } @@ -104,16 +100,13 @@ function TimeInputMobile({ value, onChange }) { return (