[Webkit-unassigned] [Bug 258987] New: Clicking a button, then calling `.focus()` on another button via JS causes `:focus-visible` to not fire.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jul 7 10:48:27 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=258987
Bug ID: 258987
Summary: Clicking a button, then calling `.focus()` on another
button via JS causes `:focus-visible` to not fire.
Product: WebKit
Version: Safari 16
Hardware: Mac (Apple Silicon)
OS: macOS 13
Status: NEW
Severity: Normal
Priority: P2
Component: CSS
Assignee: webkit-unassigned at lists.webkit.org
Reporter: konnor5456 at gmail.com
## Problem
When implementing a focus-trap by using programmatic `.focus()` calls on elements, `:focus-visible` pseudo-selectors don't propagate to the element. Only `:focus` and `:focus-within`.
`:focus-visible` disappears after clicking a <button> and then calling `.focus()` in Safari 16.4
The above works as expected in Chrome 114.0.5735.198, Edge 114.0.1823.67, and Firefox 114.0.2
## Reproduction
https://codepen.io/paramagicdev/pen/xxQXWbq?editors=1111
## Similar bugs
I think this may be a duplicate of: https://bugs.webkit.org/show_bug.cgi?id=246591
Based on the above bug, the issue may also have something to do with `e.preventDefault()`
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230707/8e85d6fb/attachment.htm>
More information about the webkit-unassigned
mailing list