-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiDataGrid] Improve aria row counts and indices for screen reader users
#6033
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
Conversation
- this enables row counts in virtualized grids to be correctly announced (instead of only counting the rendered rows) - NOTE: This works in VO+Safari but not VO+FF
- which requires passing `pagination` down to `EuiDataGridCell` and adding # of paginated rows to the visible row index
- add column header name/ID in parenthesis after column index - fix row index - was not correct on sort, and should now do so - add `-` for extra spacing between cell content and cell data, remove `:` for more natural speech cadence
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6033/ |
| data-test-subj="euiDataGridBody" | ||
| className="euiDataGrid__content" | ||
| role="grid" | ||
| aria-rowcount={rowCount} |
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.
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.
Also note that VO+Firefox does not appear to respect/announce aria-rowcount, while Safari and Chrome appear to.
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.
The Firefox + VO not honoring aria-rowcount seems like a 🐞 worth filing with Mozilla. I'll do that this afternoon.
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.
It'd be awesome to mention that aria-sort on FF/VO also does nothing!
| const content = ( | ||
| <div | ||
| role="gridcell" | ||
| aria-rowindex={ariaRowIndex} |
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.
Without aria-rowindex and aria-rowcount, the automatic table/gridcell announcement that occurs when using screen reader navigation* (ctrl+opt+arrow keys VS. just arrow keys) is off.
Before
After
*Caveat
While this is a relatively minor and low-cost addition, @1Copenut and I discussed screen reader browsing/navigation behavior on data grids and came to the conclusion they will never be optimized vs. using regular arrow keys, for a few key reasons:
- Screen reader navigation does not trigger focus (unless navigating to a focusable child within a grid cell) on a grid cell and as such the 'current cell' falls out of date. This is reproducible on W3's own datagrid example: https://www.w3.org/WAI/ARIA/apg/example-index/grid/dataGrids
- Since screen reader navigation doesn't scroll grids, it will never work properly with scrolling virtualized grids
| <p> | ||
| {'- '} | ||
| <EuiI18n | ||
| token="euiDataGridCell.position" | ||
| default="Row {row}, Column {col} ({columnId})" | ||
| values={{ | ||
| row: ariaRowIndex, | ||
| col: colIndex + 1, | ||
| columnId: column?.displayAsText || rest.columnId, | ||
| }} | ||
| /> | ||
| </p> |
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.
Adding the (column Name/ID) in parenthesis helps contextualize the cell more, similar to default aria table behavior. I changed the - and : punctuation for a more natural sounding voice flow - let me know what you think!
Before:
(Note: GH's video player appears to start muted, be sure to unmute it)
before.mp4
After
(Note: GH's video player appears to start muted, be sure to unmute it)
after.mp4
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've been listening to this read back all morning and thinking of it in terms of data importance priority. (I totally made that up). I swapped the Column Name/ID ahead of the row and column number combo. Putting myself in the place of a user digging through a column of data, I wanted to hear the data first, then the label, then my position in the grid. What do you think about swapping line 99 to be
! data_grid_cell#L99
<EuiScreenReaderOnly>
<p>
{'- '}
<EuiI18n
token="euiDataGridCell.position"
- default="Row {row}, Column {col} ({columnId})"
+ default="{columnId}. Row {row}, Column {col}."
values={{
row: ariaRowIndex,
col: colIndex + 1,
columnId: column?.displayAsText || rest.columnId,
}}
/>
</p>
</EuiScreenReaderOnly>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 don't disagree on column label/title feeling like it should come before position, but I also simultaneously feel like it makes sense to keep the column name and column index together since they're related 🤔 how about something like
{Column Title}, column {number}, row {number}
e.g., Amount, Column 2, Row 8
Not sure if this matters also, but it might be worth nothing that some column titles are extremely technical and long in Kibana and not nice and human-readable, e.g. destination.ip_address or similar
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.
@constancecchen Good call. Let's keep the column name and index together.
Your point about some Kibana column titles being technical and long is spot on. It matters, but how much is a sliding scale. I'm floating the idea elsewhere, and feel the benefits outweigh the increased cognitive load. If research proves out otherwise, we can always revisit this solution.
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.
Gotcha! So just to confirm, do you want to stay with the current copy, or do you want to change it to:
| <p> | |
| {'- '} | |
| <EuiI18n | |
| token="euiDataGridCell.position" | |
| default="Row {row}, Column {col} ({columnId})" | |
| values={{ | |
| row: ariaRowIndex, | |
| col: colIndex + 1, | |
| columnId: column?.displayAsText || rest.columnId, | |
| }} | |
| /> | |
| </p> | |
| <p> | |
| {'- '} | |
| <EuiI18n | |
| token="euiDataGridCell.position" | |
| default="{columnId}, column {col}, row {row}" | |
| values={{ | |
| row: ariaRowIndex, | |
| col: colIndex + 1, | |
| columnId: column?.displayAsText || rest.columnId, | |
| }} | |
| /> | |
| </p> |
?
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.
Let's change it to the default="{columnId}, column {col}, row {row}" you proposed in the green addition.
My apologies, comment clarity is a work in progress.
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.
|
One more thing worth noting - it appears we do not need |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6033/ |
1Copenut
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.
These aria additions are significant improvements for virtualized and paginated tables. It gives a proper context and informs users of the potential cognitive load involved in parsing data. Much appreciated!
I have just one change request, noted in its own comment.
The changes drove really well in Safari + VO, and I'll give them a second pass in Safari and Firefox later today.
| <p> | ||
| {'- '} | ||
| <EuiI18n | ||
| token="euiDataGridCell.position" | ||
| default="Row {row}, Column {col} ({columnId})" | ||
| values={{ | ||
| row: ariaRowIndex, | ||
| col: colIndex + 1, | ||
| columnId: column?.displayAsText || rest.columnId, | ||
| }} | ||
| /> | ||
| </p> |
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've been listening to this read back all morning and thinking of it in terms of data importance priority. (I totally made that up). I swapped the Column Name/ID ahead of the row and column number combo. Putting myself in the place of a user digging through a column of data, I wanted to hear the data first, then the label, then my position in the grid. What do you think about swapping line 99 to be
! data_grid_cell#L99
<EuiScreenReaderOnly>
<p>
{'- '}
<EuiI18n
token="euiDataGridCell.position"
- default="Row {row}, Column {col} ({columnId})"
+ default="{columnId}. Row {row}, Column {col}."
values={{
row: ariaRowIndex,
col: colIndex + 1,
columnId: column?.displayAsText || rest.columnId,
}}
/>
</p>
</EuiScreenReaderOnly>| data-test-subj="euiDataGridBody" | ||
| className="euiDataGrid__content" | ||
| role="grid" | ||
| aria-rowcount={rowCount} |
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.
The Firefox + VO not honoring aria-rowcount seems like a 🐞 worth filing with Mozilla. I'll do that this afternoon.
👍 I concur. Getting accurate counts of columns in Safari and Firefox + VO. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6033/ |
1Copenut
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.
The new order of announcement sounds great, and feels correct for aural UX. Code changes tested in Safari and Firefox with VoiceOver. Thanks @constancecchen !




Summary
Please see inline code comments below that highlight changes & include screen reader before/after screencaps.
Checklist