Skip to content

Commit ceb315a

Browse files
authored
fix: blur active element instead of focusing document (#683)
Instead of actively focusing the <body> when the search box is closed, just blur whatever the active element is. Has the same effect in terms of SFNSP, but doesn't cause an unwanted focus ring to appear - closes #664
1 parent 082ad3c commit ceb315a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/site-kit/src/lib/search/SearchBox.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ It appears when the user clicks on the `Search` component or presses the corresp
7474
last_scroll_position = null;
7575
document.body.style.position = '';
7676
document.body.tabIndex = -1;
77-
document.body.focus();
77+
(document.activeElement as HTMLElement)?.blur();
7878
document.body.removeAttribute('tabindex');
7979
window.scrollTo(0, scroll);
8080

0 commit comments

Comments
 (0)