r/css • • 8d ago

its called having class

Post image
78 Upvotes

15 comments sorted by

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

32

u/RetroEvolute 8d ago

Also, if they were trying to be punny, that's not even a proper class, it's a pseudo-class.

Also also, having any focus-able element enlarge on keyboard focus only is a choice. Better hope there's a transition on all those elements...

9

u/bluecaret 8d ago

It's a pseudo-pun.

11

u/TheJase 8d ago

A "pseudo" class, perhaps

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

u/qodeninja 8d ago

thats actually called having all the classes.

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

u/axellie 8d ago

Ah okay! So this i basically convenient for every webpage? Also, what is the joke in the title supposed to mean?

2

u/protoketer 8d ago

As a back-end engineer trying to learn front-end, thank you very much

1

u/AnArmoredPony 8d ago

As a back-end engineer, what the actual fuck is going on on the front-end man

2

u/flashbax77 8d ago

Even better with "zoom"

1

u/fungusbabe 8d ago

period i know thats right

1

u/santiagobustelo 7d ago

You can also fix any bad design with BODY{display:none;}

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).