select icon indicating copy to clipboard operation
select copied to clipboard

Bug: Options length is announced incorrectly by screen readers

Open GrigorM opened this issue 3 years ago • 1 comments

Description

When navigating the select component with keyboard + screen reader (i am using Screen Reader extension in Chrome, but issue is similar with all screen readers), the current options is always announced as "[options label], not selected, 2 of 3". This gives the erroneous impression that there are only 3 options in the dropdown, when there might be many more, and is confusing to the user. Instead, the correct position and full length of options list should be announced (e.g. when focus is in options 3 of a list of 8 options, it should be announced as "[option label], not selected, 3 of 8")

How to Reproduce Bug

Open a page where the Select component is present. Have a screen reader on and navigate to Select component by pressing tab. Open dropdown. Depending on the screen reader you're using the announcement might differ a little, but in general it announces a list of 2 or 3 items.

Technical description of the issue

The problem can be seen in OptionList.tsx, line 274-276. I don't know for what reason it is implemented like this, but the [role="listbox"] element should contain all options, and not just the current item and the adjacent ones.

Proposed solution

Render all the options inside the listbox element. This way the length of the list and position of the element will be announced correctly. I've already created a PR for this, where the rendering is optional by passing the prop renderFullOptionList={true} to the Select component, but I don't see a good reason why this wouldn't be the default and only way it renders

Open for suggestions or ways to achieve the desired result in other ways. Thanks!

GrigorM avatar Oct 25 '22 13:10 GrigorM

Does anyone maintain this project? Can I get an answer for this? I think it's a quite reasonable request, at least someone tell me if there's something wrong...

GrigorM avatar Nov 23 '22 11:11 GrigorM