Skip to content

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

Closed
@hoonweiting

Description

@hoonweiting

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions