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

[EuiComboBox] Improve accessibility of virtualized listbox #8333

Merged

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Feb 19, 2025

Summary

closes #8267

This PR updates EuiComboBox adding/updating it's markup to ensure expected output for screen readers.
The updates are based on the common web pattern for a combobox (ref)


Unexpected behavior:

  • the appended items being read out by the screen reader because the panel has an aria-live="assertive" applied
  • the list size is updated
  • the item position index is updated correctly
  • navigated/focused options are marked as selected

NVDA (Windows) & Chrome

Screen.Recording.2025-02-19.at.10.17.59.mov

VoiceOver (macOS) & Chrome

Screen.Recording.2025-02-19.at.09.51.01.mov

Expected behavior:

  • the appended items are not read out (remove `aria-live-"assertive" for the listbox)
  • the list size stays static and matches the available list item length (apply aria-setsize)
  • the item position index does not update and matches the index in the options array (apply aria-posinset
  • navigated/focused options are not semantically marked as selected (EuiComboBox removes selected items, so currently they are never selected inside the listbox) (apply correct condition for aria-selected)

NVDA (Windows) & Chrome

Screen.Recording.2025-02-19.at.11.41.02.mov

VoiceOver (macOS) & Chrome

Screen.Recording.2025-02-19.at.11.42.50.mov

Note

There seems to be an issue in Safari + VoiceOver(testing in Safari 18.3 and macOS 14.7.4): Navigating the option inside the list is not announced.
This seems to be related to the focus staying inside the input, but the options should actually be announced due to the correctly placed aria-descendant even if the focus is not actually moved to the options.
This is also happening for the current production state and can also be observed in external components e.g. for MUI ComboBox component.
This should rather be looked into separately if it's something we can influence or it's an issue with Safari + VoiceOver specifically. Maybe it's also macOS/browser version specific 🤷‍♀️ 🤔

QA

  • verify the mouse and keyboard behavior in staging is the same as on production
  • verify that for screen readers the correct list size and option position are announced
  • verify that newly added list options (when scrolling new options into view) do not trigger additional screen reader output

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

Sorry, something went wrong.

- ensures virtualized list behavior to reload new options is triggered
@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

@mgadewoll mgadewoll self-assigned this Feb 19, 2025
@mgadewoll mgadewoll marked this pull request as ready for review February 19, 2025 09:41
@mgadewoll mgadewoll requested a review from a team as a code owner February 19, 2025 09:41
@acstll acstll self-requested a review February 25, 2025 09:20
@weronikaolejniczak weronikaolejniczak removed their request for review February 25, 2025 10:18
Copy link
Contributor

@acstll acstll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does what it says! 💯

(checked with VoiceOver and NVDA 2024.4 + Chrome 132)


There seems to be an issue in Safari + VoiceOver(testing in Safari 18.3 and macOS 14.7.4): Navigating the option inside the list is not announced.

I don't quite understand what this means, but in any case I agree it could be addressed separately.

@mgadewoll
Copy link
Contributor Author

There seems to be an issue in Safari + VoiceOver(testing in Safari 18.3 and macOS 14.7.4): Navigating the option inside the list is not announced.

I don't quite understand what this means, but in any case I agree it could be addressed separately.

What this means is that in that scenario the screen reader focuses the input but using arrow keys to navigate the listbox options does not work.

Expected:

  • using ArrowDown/ArrowUp will announce the currently navigated option and it's role, it's selected state, it's position in the list etc

Unexpected:

  • using ArrowDown/ArrowUp does not move the screen reader to the options and does hence not announce anything
  • the screen reader cursor stays in the input
See a recording of it here
Screen.Recording.2025-02-25.at.13.29.49.mov

@acstll
Copy link
Contributor

acstll commented Feb 25, 2025

What this means is that in that scenario the screen reader focuses the input but using arrow keys to navigate the listbox options does not work.

Ah, got it. This works for me in Safari 18.2 and macOS 15.3.1, maybe it's the macOS version?

The only thing that I find weird in that environment is the disabled items, they're announced as "dimmed" (not sure if that's actually correct for VoiceOver).

@mgadewoll
Copy link
Contributor Author

mgadewoll commented Feb 25, 2025

Ah, got it. This works for me in Safari 18.2 and macOS 15.3.1, maybe it's the macOS version?

Ah, that's good news! I was wondering if it might be the OS version since I'm still on the old macOS due to my Parallels version 🫠

The only thing that I find weird in that environment is the disabled items, they're announced as "dimmed" (not sure if that's actually correct for VoiceOver).

That's expected. VoiceOver announces disabled items as "dimmed" 👍

@mgadewoll mgadewoll merged commit 99463ba into elastic:main Feb 25, 2025
6 checks passed
tkajtoch added a commit to elastic/kibana that referenced this pull request Mar 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
# Backport

This is a manual backport of #212974 and #213292

---

`99.3.0-classic.0` ⏩ `100.0.0-classic.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

---


## [`v100.0.0`](https://github.com/elastic/eui/releases/v100.0.0)

**Bug fixes**

- Fixed `EuiComboBox` by cleaning duplicated values when having a
delimiter prop. ([#8335](elastic/eui#8335))

## [`v99.4.0`](https://github.com/elastic/eui/releases/v99.4.0)

- Minor design updates to `EuiCollapsibleNavBeta`
([#8332](elastic/eui#8332))
  - Allow section without a title
- Second-level icons should be horizontally aligned with the top-level
icon
  - Turn off text truncation for nav items
- Added `quickSelectButtonProps` to `EuiSuperDatePicker`
([#8380](elastic/eui#8380))

**Bug fixes**

- Fixed a bug in `EuiHeader` where the navigation of
`EuiCollapsibleNavBeta` would render below the `EuiFlyout`'s overlay
([#8325](elastic/eui#8325))

**Accessibility**

- Improved the accessibility of `EuiComboBox` by adding `aria-setsize`
and `aria-posinset` to ensure correct information is provided for its
virtualized listbox ([#8333](elastic/eui#8333))
- Improved the `EuiAccordionTrigger`'s screen reader UX by passed
`aria-hidden` to the `EuiAccordionArrow` to avoid duplicated
announcements by screen readers.
([#8342](elastic/eui#8342))

---------

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiComboBox] Improve virtualized list accessibility
4 participants