<th> elements and elements with [role="columnheader"/"rowheader"] have data cells they describe

Table headers have associated data cells.

On this page

Impact

ScanGov impact ratings

About

Screen readers have features to make navigating tables easier. Ensuring table headers always refer to some set of cells may improve the experience for screen reader users.

Risks

Screen readers announce structured content incorrectly.

Why it's important

Helps screen readers announce structured content (tables, lists) in a logical order that users can understand.

User stories

As a screen reader user, I want tables and lists to be properly structured so that I can understand the relationships between items.

Code

Failing pattern:

<!-- Fail: th column has no corresponding data cells -->
<table>
  <tr><th>Name</th><th>Department</th><th>Notes</th></tr>
  <tr><td>Jane</td><td>Finance</td></tr>
</table>

Passing pattern:

<!-- Pass: every th has matching data cells -->
<table>
  <tr><th>Name</th><th>Department</th></tr>
  <tr><td>Jane</td><td>Finance</td></tr>
</table>

Error

ScanGov messaging when a site fails a standard:

Failed: <th> elements and elements with [role="columnheader"/"rowheader"] have data cells they describe

Guidance

Indicators

On this page