question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`input role="switch"` fails on `aria-allowed-role`

See original GitHub issue

Product

axe Linter

Product Version

v4.4.2

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

Expectation

            <label>
              <input
                type="checkbox"
                role="switch"
                name="switch"
                checked="checked"
                aria-checked="false"
              />
              Switch 1
            </label>

should (I believe) be a valid aria configuration for a switch checkbox.

Actual

This code is flagged with

axe-linter (aria-allowed-role): Ensures role attribute has an appropriate value for the elementaxe-linter[dequeuniversity/aria-allowed-role](https://dequeuniversity.com/rules/axe/4.4/aria-allowed-role?application%3Daxe-linter)

How to Reproduce

demo.html:

<!DOCTYPE html>
<html lang="en-US">
  <body>
    <label>
      <input
        type="checkbox"
        role="switch"
        name="switch"
        checked="checked"
        aria-checked="false"
      />
      Switch 1
    </label>
  </body>
</html>

Additional context

image

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
strakercommented, Dec 6, 2022

Just a heads up on this ticket. This should be fixed in the next release of axe-linter, which should be happening in the next few weeks.

1reaction
strakercommented, Sep 8, 2022

Confirmed this is a bug. Thanks for letting us know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`input role="switch"` fails on `aria-allowed-role` · dequelabs ... - GitHub
`input role="switch"` fails on `aria-allowed-role` · Run details · Usage · Workflow file.
Read more >
ARIA: switch role - Accessibility - MDN Web Docs - Mozilla
The ARIA switch role is functionally identical to the checkbox role, except that instead of representing "checked" and "unchecked" states, ...
Read more >
ARIA in HTML - W3C
Allow combobox and checkbox roles on input type=button element. ... Authors MAY use the ARIA role and aria-* attributes to change the ...
Read more >
Elements must only use allowed ARIA attributes
Using ARIA attributes in roles where they are not permitted can impair web page accessibility. Using an improper role-attribute combination will have no ......
Read more >
aria-allowed-role - Accessibility Insights
When an assistive technology encounters an invalid role, it will not be able to communicate the elements features, properties, and methods to its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found