Skip to content

[Bug]: Table sorting is not keyboard accessible #5735

@jmuzina

Description

@jmuzina

Describe the bug

The sortable table's sorting functionality is not keyboard-accessible.

The table header elements have no role or tabindex, so they are not interactable for screen readers. Our example implementation uses only JS to fire the sort events.

To Reproduce

Steps to reproduce the behavior:

  1. Go to table example
  2. Try to use a keyboard to sort the data - see that you cannot focus or interact with the headers.
  3. Use devtools to set tabindex="0" on the th elements, to make the headers keyboard interactable.
  4. Focus a sortable tab header and press ENTER.
  5. Verify the table still has not been sorted (it is only listening for click events)

Expected behavior

I should be able to tab through a table's sortable headers, and press ENTER to change the sort direction.

Sort direction should be announced with aria-sort (it already is).

Reference for example: Material UI sortable table

Additional context

Reported by @paul-geoghegan

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions