mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(header-search): blur input when active
is false (#1857)
This commit is contained in:
parent
decf966dd7
commit
6c9cf9e043
1 changed files with 2 additions and 2 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue