Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

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

Closed
heyitsjhu opened this issue Aug 28, 2019 · 1 comment
Closed
Labels
Unresolved (Archived) Open and unresolved issues and PRs that were closed due to archiving the repository.

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,
          }}```

@asyncLiz asyncLiz added the Unresolved (Archived) Open and unresolved issues and PRs that were closed due to archiving the repository. label Jan 14, 2025
@asyncLiz asyncLiz closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Unresolved (Archived) Open and unresolved issues and PRs that were closed due to archiving the repository.
Projects
None yet
Development

No branches or pull requests

3 participants