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

[@material/react-switch] Missing aria-checked attribute in input element #996

Open
heyitsjhu opened this issue Aug 28, 2019 · 1 comment

Comments

@heyitsjhu
Copy link

heyitsjhu commented Aug 28, 2019

Hi,

When I render the Switch component in Storybook with the A11Y addon, I get the following accessibility violation: "Required ARIA attribute not present: aria-checked."

image

image

I tried adding aria-checked and ariaChecked as Switch component props to see if it gets passed down directly, but it doesn't appear so. However, when I update the HTML directly and add in the attribute, the error in storybook goes away.

image

Is this something we can add to the component or is there a reason why it's omitted from the element? I'm also happy to take a stab at creating a pull request if we decided to add the attribute. :)

@stefcot
Copy link

stefcot commented Oct 28, 2021

Just try

          inputProps={{
            'aria-checked': toggled || undefined,
          }}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants