Skip to content

Commit

Permalink
fix: call focus with focusVisible set to false (#9861)
Browse files Browse the repository at this point in the history
* fix: call focus with focusVisible set to false

fixes #9002

* Update .changeset/lovely-rings-thank.md

* Update packages/kit/src/runtime/client/client.js

---------

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
GitRowin and Rich-Harris authored May 8, 2023
1 parent 36512f9 commit e445f2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lovely-rings-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: use `focusVisible: false` to prevent unwanted focus ring on navigation
3 changes: 2 additions & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,8 @@ function reset_focus() {
const tabindex = root.getAttribute('tabindex');

root.tabIndex = -1;
root.focus({ preventScroll: true });
// @ts-expect-error
root.focus({ preventScroll: true, focusVisible: false });

// restore `tabindex` as to prevent `root` from stealing input from elements
if (tabindex !== null) {
Expand Down

0 comments on commit e445f2e

Please sign in to comment.