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.

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?

screen shot 2018-08-03 at 10 19 18

screen shot 2018-08-03 at 10 19 46

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:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
momesanacommented, Dec 29, 2021

@lalitmee, Axe suggestion says that the child should have role set as textbox. I am not sure if that is required, but the issue still persists. Do you have any lead on this?

Screenshot 2019-12-10 at 5 48 29 PM

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:

Authors MUST ensure an element with role combobox contains or owns a text input element with role textbox or searchbox and that the text input has aria-multiline set to false. If the combobox provides autocompletion behavior for the text input as described in aria-autocomplete, authors MUST set aria-autocomplete on the textbox element to the value that corresponds to the provided behavior.

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: Screenshot from 2021-12-29 15-37-23

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.

0reactions
afc163commented, Mar 18, 2020

Trace #22343

Read more comments on GitHub >

github_iconTop 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 >

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