3 ms·
Yes, this is what I do, with :checked and <details> and some sibling selector trickery instead of :has (basically, the checkbox is the last element, and <detail
by chatmasta 4y ago
Yes, this is what I do, with :checked and <details> and some sibling selector trickery instead of :has (basically, the checkbox is the last element, and <details> is an accessible browser-native way to toggle visibility without javascript).
I was able to make some complex hover menus and sidebar toggles work like this entirely without JavaScript. It's also accessible, to the user. The downside is that for the developer, the resulting code is not easy to read nor maintain.
I would link to it but it's in a private repository atm. One day I'll open source this behavior as its own package... one day...
- swyx 4y agochuck it in a codepen maybe?