From 6c9cf9e043b3c963a257a28fa8dd29c8acd4b2ce Mon Sep 17 00:00:00 2001 From: metonym Date: Thu, 23 Nov 2023 07:41:22 -0800 Subject: [PATCH] fix(header-search): blur input when `active` is false (#1857) --- 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.