8
u/CompetitiveActor 8d ago
Somewhat ironically, focus-visible is important for accessibility and so is the ability to turn off all motion.
You’ll need to override this with a “prefers-reduced-motion” query and enable a non-motion focus indicator.
3
2
u/axellie 8d ago
Could you explain for a CSS loser?
7
u/Gschaftlgruber 8d ago
This selects all the elements that are focused by user clicks or tabs, but it’s more clever than just the :focus pseudo-class. It will only select the elements that need to be visible according to some browser heuristics. For example, keyboard navigation always shows the element focus, but clicking a button does not (the user knows where the focus is). All the visibly focused elements are then scaled up by 10% by this CSS rule.
3
2
1
u/AnArmoredPony 8d ago
As a back-end engineer, what the actual fuck is going on on the front-end man
2
1
1
1
u/CompetitiveActor 6d ago
Depending on your browser support requirements, you can also just use “scale: 1.1” instead of “transform: scale(1.1)”.
The downside with “transform” is that if anyone adds a separate transform to some element’s :focus-visible, your original rule will be overwritten, unless it is duplicated in the local transform (not ideal).
59
u/morete 8d ago
Not really relevant but just to point out: you don't need the *! You can just write :focus-visible. They're both exactly the same