DEV Community

Discussion on: Accessible Toggle

Collapse
 
pp profile image
Paweł Ludwiczak

If I understand this correctly, it would require JS to change the aria-checked value (which is required when using role="switch" and btw that seems to be missing in the Adapt UI Demo you linked to) and that was a constraint in my example.

Collapse
 
jameslivesey profile image
James Livesey • Edited

Good point — that's definitely a thing to add to our library! Having tested our demo in a few screen readers, they seem to still be okay with using checkboxes' checked value with the role, but it's a good idea to add the extra attribute (with JS or course) for assistive technologies that aren't as good at detecting that. Thanks for the advice!

I would assume from the docs that the aria-checked attribute is used mainly so screen readers can tell the user when a checkbox changes state on its own (without interaction), which would make sense!