role-has-required-aria-props warns about `role="switch"` missing `aria-checked` when used with native `<input checked>`
hoonweiting opened this issue · 1 comments
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?
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