-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiComboBox][A11y] Prevent custom option ids from breaking accessibility #8829
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][A11y] Prevent custom option ids from breaking accessibility #8829
Conversation
- this ensures that consumers can pass custom ids on options without breaking the internal accessibility handling of combobox
- ensures both usages of ids result in expected accessible markup
edf15b4 to
623d5a0
Compare
acstll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 I tested the changes locally with NVDA on Windows 11 (woohoo), it works as expected (also tested the current implementation, when passing ids in the options list it'll yield "blank").
I'm approving but also leaving a couple of comments regarding names that you may consider.
packages/eui/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx
Outdated
Show resolved
Hide resolved
- updates setListOptions to setListOptionRefs
💚 Build SucceededHistory
cc @mgadewoll |
💚 Build Succeeded
History
cc @mgadewoll |
`104.1.0` ⏩ `105.0.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) ## Package updates ### `@elastic/eui` #### [`v105.0.0`](https://github.com/elastic/eui/releases/v105.0.0) - Added marked row styling via the classes `euiDataGridRow--marked` and `euiTableRow--marked` for `EuiDataGrid` and `EuiBasicTable` ([#8834](elastic/eui#8834)) - Added component tokens: ([#8834](elastic/eui#8834)) - `dataGridRowBackgroundMarked` - `dataGridRowBackgroundMarkedHover` - `dataGridRowBorderActive` - `dataGridRowBorderHover` - `dataGridRowBorderMarked` - `tableRowBackgroundMarked` - `tableRowBackgroundMarkedHover` - Added `EuiFlyoutChild` and `EuiFlyoutSessionProvider` ([#8771](elastic/eui#8771)) - Added `setListOptionRefs` prop on `EuiComboBoxList` ([#8829](elastic/eui#8829)) **Breaking changes** - Removed `iInCircle` icon (use `info` instead) ([#8841](elastic/eui#8841)) - Removed `questionInCircle` icon (use `question` instead) ([#8841](elastic/eui#8841)) **Accessibility** - Improved the experience of `EuiProgress` by ensuring that determinate updates are read out immediately to screen readers ([#8839](elastic/eui#8839)) - Fixed missing screen reader output for `EuiComboBox` with `options` that have custom `id` attributes ([#8829](elastic/eui#8829)) ### `@elastic/eui-theme-borealis` #### [`v3.2.0`](https://github.com/elastic/eui/blob/main/packages/eui-theme-borealis/changelogs/CHANGELOG_2025.md#v320) - Added component tokens: ([#8834](elastic/eui#8834)) - `dataGridRowBackgroundMarked` - `dataGridRowBackgroundMarkedHover` - `dataGridRowBorderActive` - `dataGridRowBorderHover` - `dataGridRowBorderMarked` - `tableRowBackgroundMarked` - `tableRowBackgroundMarkedHover` ## Summary - **Marked row styling** for `EuiDataGrid` and `EuiBasicTable`: new CSS classes are available for consistent styling of marked rows (different from selected), including hover and cell outline styles (elastic/eui#8834) - **New flyout component**: `EuiFlyoutChild` allows side-by-side (grouped) flyout panels (elastic/eui#8771) - **Accessibility fixes:** - `EuiComboBox` now supports custom option `id`s (elastic/eui#8829) - Updates on `EuiProgress` are properly announced by screen readers (elastic/eui#8839) - **Icon updates** (breaking change): `iInCircle` and `questionInCircle` icons have been renamed to `info` and `question` respectively (elastic/eui#8841) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]>
`104.1.0` ⏩ `105.0.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) ## Package updates ### `@elastic/eui` #### [`v105.0.0`](https://github.com/elastic/eui/releases/v105.0.0) - Added marked row styling via the classes `euiDataGridRow--marked` and `euiTableRow--marked` for `EuiDataGrid` and `EuiBasicTable` ([elastic#8834](elastic/eui#8834)) - Added component tokens: ([elastic#8834](elastic/eui#8834)) - `dataGridRowBackgroundMarked` - `dataGridRowBackgroundMarkedHover` - `dataGridRowBorderActive` - `dataGridRowBorderHover` - `dataGridRowBorderMarked` - `tableRowBackgroundMarked` - `tableRowBackgroundMarkedHover` - Added `EuiFlyoutChild` and `EuiFlyoutSessionProvider` ([elastic#8771](elastic/eui#8771)) - Added `setListOptionRefs` prop on `EuiComboBoxList` ([elastic#8829](elastic/eui#8829)) **Breaking changes** - Removed `iInCircle` icon (use `info` instead) ([elastic#8841](elastic/eui#8841)) - Removed `questionInCircle` icon (use `question` instead) ([elastic#8841](elastic/eui#8841)) **Accessibility** - Improved the experience of `EuiProgress` by ensuring that determinate updates are read out immediately to screen readers ([elastic#8839](elastic/eui#8839)) - Fixed missing screen reader output for `EuiComboBox` with `options` that have custom `id` attributes ([elastic#8829](elastic/eui#8829)) ### `@elastic/eui-theme-borealis` #### [`v3.2.0`](https://github.com/elastic/eui/blob/main/packages/eui-theme-borealis/changelogs/CHANGELOG_2025.md#v320) - Added component tokens: ([elastic#8834](elastic/eui#8834)) - `dataGridRowBackgroundMarked` - `dataGridRowBackgroundMarkedHover` - `dataGridRowBorderActive` - `dataGridRowBorderHover` - `dataGridRowBorderMarked` - `tableRowBackgroundMarked` - `tableRowBackgroundMarkedHover` ## Summary - **Marked row styling** for `EuiDataGrid` and `EuiBasicTable`: new CSS classes are available for consistent styling of marked rows (different from selected), including hover and cell outline styles (elastic/eui#8834) - **New flyout component**: `EuiFlyoutChild` allows side-by-side (grouped) flyout panels (elastic/eui#8771) - **Accessibility fixes:** - `EuiComboBox` now supports custom option `id`s (elastic/eui#8829) - Updates on `EuiProgress` are properly announced by screen readers (elastic/eui#8839) - **Icon updates** (breaking change): `iInCircle` and `questionInCircle` icons have been renamed to `info` and `question` respectively (elastic/eui#8841) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]>
`104.1.0` ⏩ `105.0.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) ## Package updates ### `@elastic/eui` #### [`v105.0.0`](https://github.com/elastic/eui/releases/v105.0.0) - Added marked row styling via the classes `euiDataGridRow--marked` and `euiTableRow--marked` for `EuiDataGrid` and `EuiBasicTable` ([elastic#8834](elastic/eui#8834)) - Added component tokens: ([elastic#8834](elastic/eui#8834)) - `dataGridRowBackgroundMarked` - `dataGridRowBackgroundMarkedHover` - `dataGridRowBorderActive` - `dataGridRowBorderHover` - `dataGridRowBorderMarked` - `tableRowBackgroundMarked` - `tableRowBackgroundMarkedHover` - Added `EuiFlyoutChild` and `EuiFlyoutSessionProvider` ([elastic#8771](elastic/eui#8771)) - Added `setListOptionRefs` prop on `EuiComboBoxList` ([elastic#8829](elastic/eui#8829)) **Breaking changes** - Removed `iInCircle` icon (use `info` instead) ([elastic#8841](elastic/eui#8841)) - Removed `questionInCircle` icon (use `question` instead) ([elastic#8841](elastic/eui#8841)) **Accessibility** - Improved the experience of `EuiProgress` by ensuring that determinate updates are read out immediately to screen readers ([elastic#8839](elastic/eui#8839)) - Fixed missing screen reader output for `EuiComboBox` with `options` that have custom `id` attributes ([elastic#8829](elastic/eui#8829)) ### `@elastic/eui-theme-borealis` #### [`v3.2.0`](https://github.com/elastic/eui/blob/main/packages/eui-theme-borealis/changelogs/CHANGELOG_2025.md#v320) - Added component tokens: ([elastic#8834](elastic/eui#8834)) - `dataGridRowBackgroundMarked` - `dataGridRowBackgroundMarkedHover` - `dataGridRowBorderActive` - `dataGridRowBorderHover` - `dataGridRowBorderMarked` - `tableRowBackgroundMarked` - `tableRowBackgroundMarkedHover` ## Summary - **Marked row styling** for `EuiDataGrid` and `EuiBasicTable`: new CSS classes are available for consistent styling of marked rows (different from selected), including hover and cell outline styles (elastic/eui#8834) - **New flyout component**: `EuiFlyoutChild` allows side-by-side (grouped) flyout panels (elastic/eui#8771) - **Accessibility fixes:** - `EuiComboBox` now supports custom option `id`s (elastic/eui#8829) - Updates on `EuiProgress` are properly announced by screen readers (elastic/eui#8839) - **Icon updates** (breaking change): `iInCircle` and `questionInCircle` icons have been renamed to `info` and `question` respectively (elastic/eui#8841) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Lene Gadewoll <[email protected]>
Summary
closes #8826
This PR adds support for handling custom option ids. Since the component uses generic types for the options, it's possible for consumers to pass
id(e.g. for additional sorting on implementation side).To ensure that the accessible linking between options and input works as expected via
aria-activedescendantthis PR updates EuiComboBox by using theidvalue from the actual available option DOM elements instead of passing a static id based on theactiveOptionIndex.This ensures that the following two scenarios work and ensure that the component results in an accessible output when navigating the options list:
optionsshapeWhy are we making this change?
This update ensures that the accessibility of EuiComboBox is more robust towards consumer input and can't be broken as easily.
Screenshots
before
after
Screen.Recording.2025-06-27.at.20.40.28.mov
Screen.Recording.2025-06-27.at.20.41.04.mov
Impact to users
🟢 This update does not require any updates on consumer side.
QA
EuiComboBox > PlaygroundandEuiComboBox > With Custom IdsEuiComboBox > Playground, verify using a screen reader that the options are correctly announced on keyboard navigation in the options listEuiComboBox > With Custom Ids, verify using a screen reader that the options are correctly announced on keyboard navigation in the options listGeneral checklist
Checked in both light and dark modesChecked in both MacOS and Windows high contrast modesChecked in mobileAdded documentationProps have proper autodocs (using@defaultif default values are missing) and playground togglesChecked Code Sandbox works for any docs examplesUpdated visual regression testsIf applicable, added the breaking change issue label (and filled out the breaking change 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)