Bug 243289 - :focus-visible matches when an element is focused in an anchor’s click listener
Summary: :focus-visible matches when an element is focused in an anchor’s click listener
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-07-28 03:16 PDT by harry-moore
Modified: 2024-01-08 00:49 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description harry-moore 2022-07-28 03:16:19 PDT
When using a mouse to click an anchor which triggers a script that sets focus to another element, the focused element matches :focus-visible.

On a single page application this is really noticeable and arguably not desired behaviour.

See https://codepen.io/HazzMan2409/pen/rNdYNpa

Note this is very similar to this bug https://bugs.webkit.org/show_bug.cgi?id=236782

Maybe this issue occurs with other elements (not just anchors).
Comment 1 Radar WebKit Bug Importer 2022-08-04 03:17:14 PDT
<rdar://problem/98113373>
Comment 2 Brian Birtles 2024-01-08 00:49:00 PST
Not just clicking with a mouse, but tapping on iOS too.