Solvedreact select Critical accessibility issues: aria roles and aria-label

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

25 Answers

✔️Accepted Answer

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.

  Name of label
  <Select ... />

Other Answers:

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.

Related Issues:

react select onChange returns the selected value, not the complete event
@ashnur I'm going to address your comment for the benefit of anyone else who is seeking to understan...
react select React Select [v2] focus outline color
@Iulia-Soimaru you can style the borderColor via props like: Hi i want to change the focus outline c...
react select How to force reload of options?
This works for me: Example working: ...
react select v3 upgrade guide
Would be awesome if you could update typings for this too Currently don't believe I can import like ...
react select [V2] Warning: Prop id did not match.
I think it's instanceId prop not id prop? Getting this error in console Warning: Prop id did not mat...
react select How to set value on version 2?
Was thinking the same took me a bit From what I can tell you have to set the value to the object of ...
react select How to keep value in textbox search after choosing it
@DaveOdden (and others) For V2- I was able to enable editable text by setting the inputValue prop on...
react select Warnings: componentWillReceiveProps in strict mode, Legacy context API, findDOMNode is deprecated
For anyone else going insane over this you can disable those warnings (and other actually helpful on...
react select Add isOpen Prop
isOpen or alwaysOpen is really important property Sometimes we need it We all can make a fork to add...
react select Select doesn't render isomorphically
Use instanceId: <Select instanceId=unique name ...> Hello If I render this server side first and the...
react select Uncaught TypeError: Object(...) is not a function
Sorry I meant to follow up here when we resolved this over email The issue was with the Webpack conf...
react select textbox input clears after selecting a value from the options using redux and onInputChange returns empty even if returning the value.
I had to make the following changes to get our search working as expected: Using redux and react-sel...
react select Select in IOS doesn't work
Thanks for your reply I fixed it - in my case 'fastclick' lib causes that issue ...
react select Cursor lagging input
I also experience some sort of this bug in IE11 When you type relatively fast the input jumps back a...
react select Critical accessibility issues: aria roles and aria-label
For anyone else who stumbles upon this thread and is looking for a temporary fix.. ...
react select Styles are not applied to react-select inside a shadow-DOM component
@JedWatson we add additional check and now it works Can you update your package? ...
react select Multi labelKey or custom labelKey
Maybe labelKey can receive a function: That would be awesome! Hello ...
react select Feature Request: Allow for sorting options in filterOptions prop
Meanwhile i had to do something like this: Hope it helps someone In v1 overriding the standard filte...
react select How to specify labelkey and valuekey in version 2.1.1
You forgot to actually ask your question (which should really go to StackOverflow in this scenario) ...