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

[aria-*] attributes do not match their roles #1169

Closed
hans2103 opened this issue Aug 16, 2024 · 3 comments
Closed

[aria-*] attributes do not match their roles #1169

hans2103 opened this issue Aug 16, 2024 · 3 comments
Assignees

Comments

@hans2103
Copy link
Contributor

Describe the bug
While performing accessibility check using Lighthouse I get the following message in the results:

[aria-*] attributes do not match their roles

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://choices-js.github.io/Choices/
  2. Open Dev Tools
  3. Click on tab = lighthouse
  4. Perform Accessibility check
  5. See error / warning

Expected behavior
Expecting [aria-*] attributes to match their roles

Screenshots

Screenshot 2024-08-16 at 13 46 29

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@hans2103 hans2103 added the bug label Aug 16, 2024
@hans2103
Copy link
Contributor Author

adding role="option" to the elements that use aria-selected="true" will solve the issue.

while native HTML option elements that are descendants of a select can only be set as being selected, elements with an explicit option role can not only allow the equivalent aria-selected, but also the aria-checked attribute, supporting widgets/constructs that go beyond the capabilities of a native select element.

source: https://www.w3.org/TR/html-aria/#aria-semantics-that-extend-and-diverge-from-html

Xon added a commit to Xon/Choices.js that referenced this issue Aug 16, 2024
@Xon
Copy link
Collaborator

Xon commented Aug 16, 2024

@hans2103 thanks, I've merged that into my fork which will be pushed to my v11.0.0 PR after the weekend. I'm still working through some of the e2e tests, so main on my fork may be broken.

The diff for this change isn't complicated but I only have the ability to merge other people's PRs not my own :(

Xon added a commit to Xon/Choices.js that referenced this issue Aug 17, 2024
Xon added a commit to Xon/Choices.js that referenced this issue Aug 17, 2024
Xon added a commit to Xon/Choices.js that referenced this issue Aug 17, 2024
@Xon
Copy link
Collaborator

Xon commented Aug 17, 2024

It ended up touching a few more bits, but lighthouse accessibility score is reporting between 92 to 100 depending on the exact test page. Well better than the previous 72 or lower.

Obviously no substitute for real testing with a screen-reader.

One of the changes is to apply aria-label by extracting a matching <label for> which references the backing element's id.

@Xon Xon self-assigned this Aug 17, 2024
@Xon Xon added the WIP label Aug 17, 2024
@Xon Xon mentioned this issue Aug 22, 2024
9 tasks
@Xon Xon closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants