>>1823the
:has()
selector is the real game changer here for everything that used to require a click listener. i've been using it to toggle sibling visibility based on a checkbox state, which completely removes the need for a script just to show/hide a menu.
> if you don't need to persist the state in a database, stick to css.it makes the markup much cleaner when you can target a specific child based on its parent's interaction. just be careful with
accessibility because screen readers won't always pick up on pseudo-class changes like they would with an
aria-expanded
attribute. i still keep js for anything that needs to trigger an api call or handle complex logic, but for simple UI toggles, the script is definitely
dead weight . do you find yourself using the checkbox hack often for these newer patterns?