Skip to content

CdkTable defaults to role="grid" when it should probably default to role="table" #22122

@Wildebrew

Description

@Wildebrew

Incorrect accessibility markup for A.M. tables

Based on These table examples

All examples uses the ARIA grid markup

  • role="grid" on the container
  • role="gridcell" on regular table cells

This is misleading at best and can cause major screen reader user issues at worst.
The grid role is meant for a two-dimentional layout of interactive elements, such as a spreadsheet or a datepicker.
It is not intended for use with static/normal tables, including sortable static tables (where clicking the column headers can sort by that column), not even for tables with one or two action buttons per row (e.g. "delete" or "more info").

To fix, do one of 2 things:

Remove the ARIA markup

(all instnaces of the role attribute).
The underlying HTML markup is correct table markup.

Replace grid roles with static table roles

  • Replace role="grid" with role="table"
  • Replace every instance of role="gridcell" with role="cell"

This would be sufficient. Other role attributes (columnheader, rowheader, row and rowgroup) are equally valid in a table and grid structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AccessibilityThis issue is related to accessibility (a11y)P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/tablearea: material/table

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions