question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jelbourncommented, Mar 5, 2021

Yeah, the original intent of the cdk-table is that it is the fully interactive role="grid pattern. However, over time we’ve seen that people do often use it as a regular role="table". We should consider changing the default and making it easier to swap between the two.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 28, 2021

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ARIA: grid role - Accessibility - MDN Web Docs - Mozilla
The grid role is for a widget that contains one or more rows of cells. The position of each cell is significant and...
Read more >
Table | Angular Material
CdkTable. A data table that can render a header row, data rows, and a footer row. Uses the dataSource input to determine the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found