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.

Critical accessibility issues: aria roles and aria-label

See original GitHub issue

When running the Axe accessibility tester against the react-select v2 code-sandbox, two critical issues are identified:

  • Form elements must have labels. While you can pass aria-label as a prop to the Select component, it is not assigned as an attribute to the #react-select-2-input HTML element. Adding this attribute satisfies the Axe tester.
  • Certain ARIA roles must be contained by particular parents. Each .select__option has role="option"; however, the parent div .select__menu-list does not have role="listbox". Adding this attribute satisfies the Axe tester. Note that I had to use React Developer Tools to set menuIsOpen on the StateManager to see this violation.

Below are screenshots of the Axe test results. Form elements must have labels

Certain ARIA roles must be contained by particular parents

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:24

github_iconTop GitHub Comments

8reactions
mkandlercommented, Feb 12, 2020

For anyone else who stumbles upon this thread and is looking for a temporary fix… You can add an accessible label to the input by wrapping the component in a <label> element. This will work with screen readers and VoiceOver.

<label>
  Name of label
  <Select ... />
</label>
6reactions
IanLunncommented, Jul 4, 2019

Issue should be reopened. aria-label isn’t applied if isSearchable is set to false.

The input reported by Axe is <input id="react-select-2-input" readonly="" tabindex="0" class="css-gj7qu5-dummyInput" value="">

@bmsuseluda You should actually be using hyphen cased syntax for aria attributes but that is not the issue here – aria-label doesn’t work either.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ARIA Techniques for WCAG 2.0 - W3C
To improve accessibility, WAI-ARIA provides Web developers with the option to ... WAI-ARIA map WAI-ARIA roles and properties to platform accessibility APIs.
Read more >
Using ARIA: Roles, states, and properties - MDN Web Docs
ARIA defines semantics that can be applied to elements, with these divided into roles (defining a type of user interface element) and states ......
Read more >
ARIA Made Easy | IT Accessibility - University of Arizona
WAI-ARIA addresses these accessibility challenges, for example, by defining new ways ... ARIA defines these roles for easier navigation by screen readers:.
Read more >
Elements must only use allowed ARIA attributes | Axe Rules
Find and fix up to 80% of accessibility issues with axe DevTools Pro. ... ARIA explicitly defines which attributes are allowed for any...
Read more >
Introduction to ARIA - Accessible Rich Internet Applications
If an ARIA role is added to the <ul> —for example, ... accessible name defined using aria-label or aria-labelledby (e.g., <div role="region" ...
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