Skip to content

EuiTableHeaderCell should read aloud text content instead of aria-label #1378

@cjcenizal

Description

@cjcenizal

The current implementation uses aria-label to override the default screen reader behavior of reading aloud the text contents: https://github.com/elastic/eui/blob/master/src/components/table/table_header_cell.js#L61

This presents two problems:

  • It means that providing a node as children will cause the screen reader to read something like "Sort [Object object] ascending".
  • As the user traverses the cells in the table body, the screen reader reads aloud the associated column header to help the user orient themselves. This means the user hears "Sort {column title} ascending/descending" for each cell they navigate to, which is confusing to hear.

I think one solution would be to use the sortIcon to provide screen-reader-specific sort information. Instead of conditionally rendering it, we could always render it but wrap it in EuiScreenReaderOnly when the column isn't being sorted on. We could then put aria-label={Click to sort ascending/descending} on the sort icon, which will be read aloud after the column text content is read.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions