Please consider fixing the ARIA roles for your <Select> component - children need listbox aria roles.
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
Performing a lighthouse audit on https://ant.design/components/select/ throws up Accessibility warnings which relate to the Select boxes not adhering to the ARIA best practise. It seems to me that the ant-select-selection ant-select-selection--single
wrapper div
has role="combobox"
but the children have no aria roles (listbox
) when in the collapsed state?
What does the proposed API look like?
The Select.Option
component, rendered as the .ant-select-selection__rendered
div
should have a role="listbox"
to conform to ARIA best practise.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
ARIA: listbox role - Accessibility - MDN Web Docs - Mozilla
The listbox role is used to identify an element that creates a list from which a user may select one or more static...
Read more >Listbox Example | WAI-ARIA Authoring Practices 1.1
Role, Property, State, and Tabindex Attributes ; ul ; Example 2 only: Applied to the element with the listbox role, tells assistive technologies...
Read more >Accessible Rich Internet Applications (WAI-ARIA) 1.3
Please see the WAI-ARIA Overview for links to related documents for other ... For example, the listbox role requires ownership of an element...
Read more >NVDA screen reader not finding names of child elements - ...
You also need to add aria-selected="true" (or false) to each <li role="option"> to indicate whether an item is selected or not.
Read more >JavaScript Data Grid: Accessibility
ARIA Attributes · role="grid" - marks the enclosing element of the grid. · role="rowgroup" - element that serve as container for the table...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, that is IMHO (and I am a complete Newbie in terms of a11y) a bug and still persists in the newest version of Antd. A description of a11y do’s and don’ts can be found here:
https://www.digitala11y.com/combobox-role/
In particular, the source says this about the mandatory structure that an author of a custom combobox components needs to adhere to:
As per what the source says, the top-level ant-select element should’ve had a role of combobox while the input element must have its role set to searchbox (if searchable) as is implicitly the case when type is set to search. Unfortunately the top-level element has not been assigned the combobox role and the input element contained within the ant select component has it’s perfectly correct implicit role erroneously overriden by the combobox role. Once we remove the attribute it defaults back to the correct implicit role as can be seen here:
Overriding implicit aria roles is rarely justified and the given DOM structure seem to be at odds with the one prescribed by the standard (unless the document above is inaccurate).
Again, IMHO this issue should be reopened.
Trace #22343