markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 101 forks source link

a11y: aria-checked #58

Closed Stenbaek closed 3 years ago

Stenbaek commented 4 years ago

The input has role="switch", but has no corresponding aria-checked.

This is flagged for a site doing a Lighthouse accessibility audit.

Screenshot 2019-12-16 at 14 50 17
Stenbaek commented 4 years ago

I just realized that {...rest} is being passed on to the input. I know that you can add it yourself then, but imo it should be handled out of the box.

monicahung commented 4 years ago

The ARIA specification states that the aria-checked attribute needs to be specified if using the switch role.

https://www.w3.org/TR/wai-aria-1.2/#switch

gh640 commented 4 years ago

@markusenglund It looks like you stopped maintaining this package... 😢 Do you have any plan to commit these pull requests?

markusenglund commented 3 years ago

I'm sorry for responding to this very late.

I've merged monicahung's PR. It will be deployed in a new release soon.