From 15a77af1000c3199c2567915dff1c9ce2990a902 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 28 Oct 2024 11:24:27 -0400 Subject: [PATCH] blur active element instead of focusing document - closes #664 --- packages/site-kit/src/lib/search/SearchBox.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/site-kit/src/lib/search/SearchBox.svelte b/packages/site-kit/src/lib/search/SearchBox.svelte index 09b21e06c3..4b83a75f27 100644 --- a/packages/site-kit/src/lib/search/SearchBox.svelte +++ b/packages/site-kit/src/lib/search/SearchBox.svelte @@ -74,7 +74,7 @@ It appears when the user clicks on the `Search` component or presses the corresp last_scroll_position = null; document.body.style.position = ''; document.body.tabIndex = -1; - document.body.focus(); + (document.activeElement as HTMLElement)?.blur(); document.body.removeAttribute('tabindex'); window.scrollTo(0, scroll);