Fix JS error when clicking an item in a filter list

demo
Zef Hemel 2022-11-19 15:22:33 +01:00
parent f28b0a33bc
commit be6d98ba1a
1 changed files with 3 additions and 4 deletions

View File

@ -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);
}}
>