[mdc-switch] add required aria-checked
Feature Request
The current mdc-switch component uses role='switch' but not the required aria attribute aria-checked as described by MDN:
The aria-checked attribute is required when using the switch role, as it represents the current state of the widget that the switch role is applied to. A value of true represents the "on" state; false represents the "off" state; a value of mixed is not supported by the switch role, and is treated as false. The default value is false.
Proposed solution
add aria-checked to the mdc-switch component
Alternatives considered
/
Additional context
Noticed this issue while searching for accessibility issues on our current projects. Everything else works as expected
Hi,
Thank you for your suggestion. I'm assuming you are referring to updating the README for switch to include aria-checked in the listed templates? (Since the aria-checked attribute is already present in the demo: https://material-components.github.io/material-components-web-catalog/#/component/switch)
Please feel free to submit a pull request to update the docs accordingly!
Hey,
Yes, i'm talking about the README files. I (and i guess most people) use the codes snippets presented in the README docs.
I'll go read the pull-request documentation and give it a try.
Looks like the logic is missing from the component itself - the catalog's react component wrapping hides this issue. The above pull request should address this.