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

This commit is contained in:
metonym 2023-11-23 07:41:22 -08:00 committed by GitHub
commit 6c9cf9e043
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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.