-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Critical accessibility issues: aria roles and aria-label #3355
Comments
thanks for this @geoffrey1218, we'll have a closer look at these to harden accessibility in selects. |
@sarahbethfederman if you could have a look at this issue, that would be awesome |
Hi! I'm not able to reproduce the first issue. May be that it was fixed in react-autosize-input. When providing an aria-label prop to the Select, it seems to be applied to the input. Here's a sandbox demo-ing this with a label value of "this is a label!!!" https://ryw61w7rnn.codesandbox.io/ Looking into second issue now :) |
I think this issue can be closed |
(someone yell at me if I'm not supposed to close issues) |
doesn't work for me if isSearchable is false. Can you check the reason behind this? |
@bmsuseluda can you be a bit more specific about what part isn't working for you? Happy to look into this. |
Sorry for my short message. |
Issue should be reopened. The input reported by Axe is @bmsuseluda You should actually be using hyphen cased syntax for aria attributes but that is not the issue here -- |
Can confirm this is still broken in 3.0.4 |
Looks like the issue is in Select.js renderInput, if !isSearchable it renders a DummyInput without applying the aria attributes that it does to the normal Input it renders otherwise. |
@ZLJasonG I am having this exact same issue too. If when |
I am also having this issue. @sarahbethfederman could this issue be reopened? |
For anyone else who stumbles upon this thread and is looking for a temporary fix...
|
Applying I am using React Testing Library, which locates elements like a user would (text, labels, |
Your point is still valid, @onebree, but just in case this helps ya: https://github.com/romgain/react-select-event |
@kylemh Thanks! I'll definitely consider adding that to the project. In the meantime, I was able to call |
EDIT: 🎉 I've archived the fork now that we've got some momentum in this repo and Jed is involved again. Sorry for the disturbance! |
Greetings, This issue was reopened due to the use-case of the aria-label not being applied to the "DummyInput" which impairs accessibility to the Select when I can confirm that this behavior has been addressed here: #3090 Since the described behavior which caused this issue to be reopened has been resolved, I will be closing this issue again with the understanding that this will give more visibility to remaining accessibility issues. |
Hi @geoffrich ! In your initial question you referenced react-select v2 code-sandbox, and I see that all options in this example have The only way I see from the docs is by customizing Option, like this: |
Greetings @marisev, Attributes can be applied to a custom component by accessing the the I posted an implementation method here specifically for accessibility that might be of interest. #4322 (comment) Please let me know if you have any questions. |
@ebonow Thank you Eric, I just tried using |
@marisev glad it's working for you Marina! No worries as the documentation is admittedly a bit dense and easy to miss things. It's in the process of being completely redesigned so it should be a bit easier to sift through everything in the near future. |
When running the Axe accessibility tester against the react-select v2 code-sandbox, two critical issues are identified:
aria-label
as a prop to theSelect
component, it is not assigned as an attribute to the#react-select-2-input
HTML element. Adding this attribute satisfies the Axe tester..select__option
hasrole="option"
; however, the parent div.select__menu-list
does not haverole="listbox"
. Adding this attribute satisfies the Axe tester. Note that I had to use React Developer Tools to setmenuIsOpen
on theStateManager
to see this violation.Below are screenshots of the Axe test results.

The text was updated successfully, but these errors were encountered: