[EuiSelectable][EuiComboBox] Fix duplicated screen reader announcements of option name and checked state - #9850
Draft
alexwizp wants to merge 3 commits into
Draft
Conversation
…uncement The checked state of a selectable list item is already conveyed natively via aria-checked/aria-selected, so the additional visually-hidden "Checked option." text caused screen readers (e.g. NVDA) to announce the state twice. Fixes elastic/kibana#216048 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…element A title attribute on the option <li> maps to the option's accessible description (HTML-AAM), which screen readers announce in addition to the accessible name - so the option name was read twice. Moving the title to the inner text element keeps the hover tooltip for truncated text without affecting the option's name/description computation. Part of elastic/kibana#216157 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EuiSelectable/EuiComboBoxoptions. Two changes:EuiSelectableListItem.titleattribute from the option<li>element to its inner text element (EuiSelectableandEuiComboBox).aria-checked/aria-selectedon the option<li>, so screen readers (e.g. NVDA) announced the checked state twice — once from the ARIA attribute ("checked 1 of 4") and once from the extra hidden text ("Checked option.").titleattribute on the option<li>maps to the option's accessible description (per HTML-AAM), which screen readers announce in addition to the accessible name — so the option name was read twice.euiSelectableListItem.checkedOptionstate string forchecked="on"inselectable_list_item.tsx. The "Excluded option." (checked="off") and "Mixed (indeterminate) option." (checked="mixed") state texts are kept, as those states are not (or not reliably) distinguishable from the ARIA attributes alone. Keyboard instructions ("To uncheck/exclude this option, press Enter.") are unchanged.EuiSelectableListItemnow interceptstitleand renders it on the.euiSelectableListItem__textspan viatextProps;EuiComboBoxOptionsListdoes the same foreuiComboBoxOptionitems. The native hover tooltip for CSS-truncated text is preserved (it now triggers over the text rather than the whole row), but thetitleno longer participates in the option's accessible name/description computation. Follows up on [EuiToolTip] Replace all title attributes with EuiToolTip #9643, which narrowed when thetitleis set.Screen reader output for a checked option "System", before → after:
API Changes
euiSelectableListItem.checkedOptioni18n tokenaria-checked/aria-selectedtitleattribute<li>, so it no longer becomes the option's accessible descriptiontextPropsCommonProps & HTMLAttributes<HTMLElement>) in addition toCommonPropsScreenshots
N/A — no visual changes; only visually-hidden screen reader text and attribute placement are affected (see before/after announcement text above).
Impact Assessment
Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.
[title=...]on the<li>will need to target the inner text element instead — e.g. snapshot tests ofEuiSelectable/EuiComboBox/filter popover options.Impact level: 🟢 Low
Release Readiness
Documentation:N/A — no API or docs changesFigma:N/AMigration guide:N/AAdoption plan (new features):N/A — bug fixQA instructions for reviewer
EuiSelectabledemo with checked options (e.g. the Selectable docs or anEuiSearchBarfield_value_selectionfilter popover).titleattribute).EuiComboBoxoptions — the option name is announced only once.allowExclusions, navigate to an excluded option — "Excluded option." is still announced.EuiSelectable/EuiComboBox— the native browser tooltip with the full text still appears.Checklist before marking Ready for Review
QA: Tested docs changesN/Atitleplacement, and updated Cypress a11y assertionsBreaking changes: AddedN/Abreaking changelabelReviewer checklist