Focus style should use :focus-visible instead of :focus

Created on 11 March 2024, 4 months ago
Updated 13 March 2024, 4 months ago

Problem/Motivation

Focus styles should only apply when they are really necessary, e.g. when navigating with the keyboard. See this explanation on MDN:

Browsers no longer visibly indicate focus (such as by drawing a "focus ring"), around each element when it has focus. Instead, they use a variety of heuristics to provide focus indicators only when it would be most helpful to the user. For instance, when a button is clicked using a pointing device, the focus is generally not visually indicated, but when a text box needing user input has focus, focus is indicated.

Proposed resolution

Use the :focus-visible pseudo-selector, instead of :focus.

✨ Feature request
Status

Needs review

Version

2.1

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany mrshowerman Munich

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024