Skip to content
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

NVDA does not announce the selected entry in "listbox" and "combobox" #1599

Closed
lenzls opened this issue Jun 17, 2022 · 2 comments · Fixed by #1812
Closed

NVDA does not announce the selected entry in "listbox" and "combobox" #1599

lenzls opened this issue Jun 17, 2022 · 2 comments · Fixed by #1812
Assignees

Comments

@lenzls
Copy link

lenzls commented Jun 17, 2022

What package within Headless UI are you using?

@headlessui/react (problem is also present in vue)

What version of that package are you using?

v1.4.2

What browser are you using?

Chrome & Firefox

Reproduction URL

https://headlessui.dev/react/listbox

Describe your issue

NVDA does not announce the currently selected item in the "listbox (select)" and "combobox" components.

Note that I'm not sure how other screen readers behave.

When going through the list in a select dropdown, NVDA does not highlight the currently selected entry (here "Tom Cook") in any way.
scrot_2022-06-17_12-05-58_screenshot

While the same also happens when navigating through the list in a default HTML select. There is one big difference to headless-UI though, namely that the selection follows the keyboard focus in a native select, but in a headless-UI select, it does not.
It appears that the rationale, why NVDA does not announce the selected entry is based on this fact (see here).

As the selection here does not follow the focus, IMHO headless-UI should inform the user about the currently selected entry when navigating through the list.

Implementation suggestion

This could be achieved by adding aria-selected="false" to the non-selected entries. This would be in addition to aria-selected="true" on the selected entry, which headless-UI already sets.

The following example clarifies the behaviour:
https://codepen.io/simondl/pen/xxYBBXL?editors=1000
scrot_2022-06-17_12-32-41_screenshot

Without aria-selected="false", all entries are announced without a hint on their selection state.
With setting aria-selected="false" on the non-selected entries, all non-selected entries are differentiable to the selected one.


I'd be happy to supply a MR in case the behaviour is wanted.

@JesusTheHun
Copy link

Yep, this is so annoying.
MacOS Voice Over behaves even worse : unless explicitly told aria-selected=false every active option is announced as selected. In your codepen for example, if I remove the aria-selected=false, I hear : opt 1, selected, 1 of 4.

This is weird especially in case of multi-select because the rationale exposed in the link you've given do not stand.

@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

This should be fixed by #1812, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants