From abbe1dc014cfe12c48234730a72bda39c8563937 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Mon, 19 Dec 2022 12:05:04 +0800 Subject: [PATCH] fix: hotkey error when quick search blur --- packages/app/src/components/quick-search/input.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/app/src/components/quick-search/input.tsx b/packages/app/src/components/quick-search/input.tsx index fe608295da..32dbe7f27b 100644 --- a/packages/app/src/components/quick-search/input.tsx +++ b/packages/app/src/components/quick-search/input.tsx @@ -17,13 +17,19 @@ export const Input = (props: { const [inputValue, setInputValue] = useState(''); const inputRef = useRef(null); useEffect(() => { + inputRef.current?.addEventListener( + 'blur', + () => { + inputRef.current?.focus(); + }, + true + ); return inputRef.current?.focus(); }, [inputRef]); useEffect(() => { return setInputValue(props.query); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - return (