Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mdc-switch] add required aria-checked #5202

Closed
kvdheuvel opened this issue Oct 25, 2019 · 3 comments · Fixed by #5357
Closed

[mdc-switch] add required aria-checked #5202

kvdheuvel opened this issue Oct 25, 2019 · 3 comments · Fixed by #5357

Comments

@kvdheuvel
Copy link

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

@allan-chen
Copy link
Collaborator

allan-chen commented Oct 31, 2019

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!

@kvdheuvel
Copy link
Author

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.

@allan-chen
Copy link
Collaborator

allan-chen commented Dec 18, 2019

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.

@allan-chen allan-chen added the bug label Dec 18, 2019
Yavanosta added a commit that referenced this issue Dec 24, 2019
Yavanosta added a commit that referenced this issue Dec 24, 2019
BREAKING CHANGE: Added setNativeControlAttr method in mdc-switch adapter.
Yavanosta added a commit that referenced this issue Dec 24, 2019
Yavanosta added a commit that referenced this issue Jan 7, 2020
* fix(switch): handle aria-checked correctly. (#5202)

BREAKING CHANGE: Added setNativeControlAttr method in mdc-switch adapter.

* fix(switch): fix typos and always on switch documentation. (#5202)

* fix(switch): replace constants with boolean to string conversion. (#5202)

* fix(switch): fix typo. (#5202)
This was referenced Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants