3 ms·
If you disable JS on HN that button goes away, but you can still up / down vote. I like that, I wonder if the [-] could be implemented in CSS though, I feel lik
by giancarlostoro 8y ago
If you disable JS on HN that button goes away, but you can still up / down vote. I like that, I wonder if the [-] could be implemented in CSS though, I feel like it can.
- humblebee 8y agoSeems like it could be done with a checkbox and some cash. I'm sure someone could figure it out.
- spuz 8y agoThe article has exactly this scenario as an example of where pure CSS can replace JS.
- pawelk 8y agoIt could be done using `input:checked + sibling` selector e.g. like this: https://jsfiddle.net/6bgemn0s/ https://jsfiddle.net/6bgemn0s/ For something fancier it would be possible to style a label with appropriate for="" attribute and hide the checkbox completely, then even apply some transitions: https://jsfiddle.net/6bgemn0s/1/ https://jsfiddle.net/6bgemn0s/1/
- hokus 8y agohttps://jsfiddle.net/gaby_de_wilde/ye95zcao/29/ https://jsfiddle.net/gaby_de_wilde/ye95zcao/29/
- jgtrosh 8y agoI believe using a checkbox element and the :checked selector alongside siblings matching would do the trick.
- Tade0 8y agoThat would do nothing for screen readers thus compromising accessibility.
- giancarlostoro 8y agoI've done / seen so many hacky things in web dev I would be surprised how many websites even work properly with screen readers.
- Tade0 8y agoSuch is the sad state of web development.
- giancarlostoro 8y agoAs I do hacky work on the web I sometimes wonder why specific UI elements don't exist yet instead of people being forced to hack other elements to do things the web doesn't support. I can't remember a good example off the top of my head currently sadly.
- extra88 8y agoIf you use the checked state to of a checkbox to change the display property (i.e. toggle between none and initial), that will change the content's visibility and its availability to screen readers.
- brlewis 8y agoCould you just nest <details> elements?