From be6d98ba1abadd665ea12335abf2349d531dffff Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sat, 19 Nov 2022 15:22:33 +0100 Subject: [PATCH] Fix JS error when clicking an item in a filter list --- web/components/filter.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/components/filter.tsx b/web/components/filter.tsx index e7d8a8f6..c24b16a9 100644 --- a/web/components/filter.tsx +++ b/web/components/filter.tsx @@ -129,14 +129,12 @@ export function FilterList({ value={text} placeholder={placeholder} ref={searchBoxRef} - // onChange={filterUpdate} onBlur={(e) => { - if (!exiting) { - searchBoxRef.current!.focus(); + if (!exiting && searchBoxRef.current) { + searchBoxRef.current.focus(); } }} onKeyUp={(e) => { - // console.log("Key up", / e); if (onKeyPress) { onKeyPress(e.key, text); } @@ -207,6 +205,7 @@ export function FilterList({ }} onClick={(e) => { e.preventDefault(); + exiting = true; onSelect(option); }} >