fix(header-search): blur input when active is false

This commit is contained in:
Eric Liu 2023-11-23 07:33:25 -08:00
commit ea0a1b901a

View file

@ -46,6 +46,7 @@
}
$: if (active && ref) ref.focus();
$: if (!active && ref) ref.blur();
$: dispatch(active ? "active" : "inactive");
$: selectedResult = results[selectedResultIndex];
$: selectedId = selectedResult
@ -116,9 +117,8 @@
break;
case 'Escape':
if (value === '') {
// If the search bar is empty, deactivate and blur the input.
// If the search bar is empty, deactivate the input.
active = false;
ref?.blur();
}
// Reset the search query but keep the search bar active.