You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When navigating EuiDataGrid header cells with screen readers (e.g. NVDA on Windows) it will output a duplicated text for a sorted cell.
This is due to the cell having both an aria-sorted attribute and an additional screenreader-only hint text linked via aria-describedby.
We should check if we can remove the additional hint text. There might be reason for having it in case aria-sort might not be supported consistently across assistive technologies. This requires testing if aria-sort is output as expected by at least the main screen readers (JAWS, NVDA, VO).
Steps
test the sorted cell in the EuiDataGrid header in the most common SR combinations:
Chrome + NVDA
Chrome + JAWS
Firefox + NVDA
Firefox + JAWS
Safari + VoiceOver
update the conditions in packages/eui/src/components/datagrid/body/header/column_sorting.tsx
if(!hasColumnActions&&hasOnlyOneSort)returnnull;// in this scenario, the `aria-sort` attribute will be used by screen readers
return(
where hasOnlyOneSort = "only one column is sorted" and !hasColumnActions means there's no context menu on the header cell:
Proposed solution
If we remove the !hasColumnActions from the condition in the sortingScreenReaderText, the logic will no longer consider whether column actions are available and will render the helper text always, as long as multiple columns are sorted.
To ensure that ariaSort and sortingScreenReaderText are exclusive, we can refactor the logic to use a shared condition, e.g.:
constuseAriaSortOnly=isColumnSorted&&hasOnlyOneSort;// in `ariaSort`:constariaSort: AriaAttributes['aria-sort']=useAriaSortOnly
? sorting.columns[0].direction==='asc'
? 'ascending'
: 'descending'
: undefined;// in `sortingScreenReaderText`:if(!isColumnSorted||useAriaSortOnly)returnnull;return(
...
Considerations
Note - unfortunately this is not the case for column headers with no actions - since describedby does not work for those cells and they're using SR only text, the extra text comes along for the ride
Activity
JasonStoltz commentedon Apr 3, 2025
We pointed this as a 3. The work itself is probably 1, but testing in different environments.
This is based on the assumption that we can remove the additional hint text.
weronikaolejniczak commentedon Apr 16, 2025
Testing notes
Environment
Using EuiDataGrid playground with
sortingprop value set to:{ "columns": [{ "id": "name", "direction": "desc" }] }Steps to reproduce
[aria-sort="descending"]column - "Name".Screen recordings
Chrome + NVDA (Windows)
Screen.Recording.2025-04-16.134559.mp4
Chrome + JAWS (Windows)
Audio on 🔈
Screen.Recording.2025-04-16.140622.mp4
Firefox + NVDA (Windows)
Screen.Recording.2025-04-16.135155.mp4
Firefox + JAWS (Windows)
Audio on 🔈
Screen.Recording.2025-04-16.140654.mp4
Safari + VoiceOver (MacOS)
Screen.Recording.2025-04-16.at.13.20.41.mov
Multi-column sorting:
Using EuiDataGrid playground with
sortingprop value set to:{ "columns": [ { "id": "name", "direction": "desc" }, { "id": "account", "direction": "asc" } ] }Screen.Recording.2025-04-16.at.14.32.44.mov
Implementation context
aria-sortIf only one column is being sorted, the
aria-sortattribute is set conditionally to indicate the sorting direction:eui/packages/eui/src/components/datagrid/body/header/column_sorting.tsx
Lines 51 to 68 in cb22e29
All common screen reader + browser combinations support
aria-sortannouncement.sortingScreenReaderTextIf multiple columns are being sorted, the helper text is announced. It's rendered conditionally:
eui/packages/eui/src/components/datagrid/body/header/column_sorting.tsx
Lines 70 to 76 in cb22e29
where
hasOnlyOneSort= "only one column is sorted" and!hasColumnActionsmeans there's no context menu on the header cell:Proposed solution
If we remove the
!hasColumnActionsfrom the condition in thesortingScreenReaderText, the logic will no longer consider whether column actions are available and will render the helper text always, as long as multiple columns are sorted.To ensure that
ariaSortandsortingScreenReaderTextare exclusive, we can refactor the logic to use a shared condition, e.g.:Considerations
#6034