News for hackers. Stuff that matters.
Re:If it goes somewhere, it’s a link. If it does something, ... by eyelidlessness on Tuesday October 11, 2022 @09:15PM (#33171499)
I do this too if I’m trying to play JS payload golf and the stakes are low for users, but I always feel guilty because I know it harms accessibility. JS is actually required to make an expandable/collapsible menu accessible, even if your clever pure-CSS solution seems bulletproof. It’s a shame, there really should be native controls for this kind of thing that don’t require arbitrary executable code.
Re:If it goes somewhere, it’s a link. If it does something, ... by runarberg on Wednesday October 12, 2022 @02:02AM (#33173431)
This is precisely what <details> <summary> is for. No javascript required. It gives the correct semantics for assistive technology, correct interactions with the keyboard, focusability, etc. I recommend you use it over the old checkbox hacks or javascripts.