119
submitted 10 months ago by Strawberry to c/programmer_humor@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] Strawberry 17 points 10 months ago* (last edited 10 months ago)

CSS has a pseudo-class, :focus-visible, that matches when an element is focused using keyboard navigation. It also has :focus-within, which matches when the current focused element is the selected element or one of its descendents. However, this applies not only for keyboard navigation but also mouse and tap focus. A pseudo-class that combines the two, :focus-visible-within, would be useful, but does not currently exist. Here's an article about it: https://larsmagnus.co/blog/focus-visible-within-the-missing-pseudo-class

The code in the meme implements the logic of :focus-visible-within using the new :has() functional pseudo-class, and has a snippet of fallback behavior for slightly older browsers

[-] Skullgrid@lemmy.world 2 points 10 months ago

thanks for the explaination!

this post was submitted on 23 Mar 2024
119 points (100.0% liked)

Programmer Humor

20026 readers
49 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS