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

role-has-required-aria-props warns about role="switch" missing aria-checked when used with native <input checked> #932

Closed
hoonweiting opened this issue Nov 1, 2023 · 1 comment · Fixed by #1071
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@hoonweiting
Copy link

I have a custom switch built with <input type="checkbox">:

<input
  type="checkbox"
  role="switch"
  :checked="isChecked"
>

After enabling role-has-required-aria-props, the following problem is reported:

Elements with the ARIA role "switch" must have the following attributes defined: aria-checked

I believe this is a false positive. <input type="checkbox"> already has its own checked, and I'd think we shouldn't need to replace it with aria-checked. A similar issue was reported for Svelte's ESLint plugin: sveltejs/svelte#7837

Should we consider allowing checked in place of aria-checked?

@vhoyer
Copy link
Collaborator

vhoyer commented Dec 5, 2023

ok, I think you are correct, we should allow checked as a replacement for "aria-checked" if the current element is an input, basing this decision on this link from wai-aria: https://www.w3.org/WAI/ARIA/apg/patterns/switch/examples/switch-checkbox/

PRs are welcomed, sorry for the late reply I was on vacation

@vhoyer vhoyer added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Dec 5, 2023
JoCa96 added a commit to JoCa96/eslint-plugin-vuejs-accessibility that referenced this issue Mar 25, 2024
vhoyer pushed a commit that referenced this issue Apr 24, 2024
…t element (#1071)

* fix #932 not required switch prop

* extended comment

Closes #932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
2 participants