From ea0a1b901af21817f3baf72fcdcfbc2740f44eb8 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Thu, 23 Nov 2023 07:33:25 -0800 Subject: [PATCH] fix(header-search): blur input when `active` is false --- src/UIShell/HeaderSearch.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UIShell/HeaderSearch.svelte b/src/UIShell/HeaderSearch.svelte index 105fc0fc..44b93572 100644 --- a/src/UIShell/HeaderSearch.svelte +++ b/src/UIShell/HeaderSearch.svelte @@ -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.