Skip to content

grid: sortable column headers don't convey their interactive nature #168

@TetraLogicalHelpdesk

Description

@TetraLogicalHelpdesk

WCAG Level

Level A

Priority

High

Pages/screens/components affected

Description

Column headers that are sortable in a grid don't programmatically expose an interactive role. They are announced just as regular column headers, giving no indication that they are interactive.

Example of sortable column headers

User impact

When an assistive technology user reaches a column header, their screen reader will not announce the header as being interactive. If the header is already currently sorted, the sort order is announced ("ascending" or "descending"), which will provide a clue to users that they may be able to toggle it to change the sort order. But when a column header is currently not sorted, no special announcement/indication will be given to users. Users may miss that there is sort functionality at all.

Required solution

Interactive controls must be exposed as such programmatically. As sortable column headers act as buttons, they must have an appropriate role that conveys this.

Implementation guidance

Currently, sortable column headers use the same markup (once processed) as regular non-sortable headers, with the only exception being the aria-sort attribute.

<th ... tabindex="0" role="columnheader" ... aria-sort="none">...</th>

At a high level, you will also want to convey that the header contains a button - an interactive control which can be triggered by the user.

As a good example of a table with sortable column headers, see the WAI-ARIA Authoring Practices 1.1 Data Grid Examples, and specifically Example 2: Sortable Data Grid With Editable Cells. Note how the focusable element in this case is exposed with a role="button", but it is also still inside an appropriate <th> which has the aria-sort attribute (rather than the <th>'s native column header role being overridden).

Test procedure(s)

Use these steps to confirm that the solution has been correctly applied to issues identified within the test sample, and to test the rest of the website for instances of the same issue:

  1. Turn on your screen reader
  2. Navigate through the grid with sortable column headers.
  3. Verify that the sortable column headers are announced as buttons (and, if a sort order is set, that they still correctly announce the current sort order).
  4. Navigate through the data cells in the grid and verify that these column headers still correctly act as column headers, giving a name to the column they refer to.

Definition of done

Complete all of these tasks before closing this issue or indicating it is ready for retest:

  • All issues identified within the test sample have been resolved.
  • The rest of the components, their variants, and the documentation website have been tested for the same issue.
  • All issues identified throughout the rest of the components/website have been resolved or filed as new issues.

Related standards

More information

Test data

Test date: March 2021
Website: vaadin.com/components, vaadin.com/docs-beta

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions