Skip to content
SilktideHelp

Table heading scopes

Silktide checks that every table heading cell declares what it is a heading for - a column, a row, or a group of them. This tells which cells each heading applies to.

In , a <th> heading cell can head a column, a row, or a group of columns or rows. The scope attribute states which, removing any ambiguity about the table's structure.

<!-- Problem: nothing says whether "Name" heads a column or a row -->
<th>Name</th>

<!-- Fixed: the scope makes it explicit -->
<th scope="col">Name</th>

Why this matters

A announces the relevant headings alongside each cell as the listener moves through a table. To do that, it needs to know which cells each heading governs. In tables that have both column and row headings, or headings that span groups of cells, a heading without a scope forces the screen reader to guess - and when it guesses wrong, values are announced with the wrong context or none at all.

How to fix it

Add a scope attribute to every <th> cell. The valid values are:

  • col - the heading applies to the column below it.
  • row - the heading applies to the row beside it.
  • colgroup - the heading applies to a group of columns.
  • rowgroup - the heading applies to a group of rows.
<table>
  <tr>
    <th scope="col">Name</th>
    <th scope="col">Age</th>
  </tr>
  <tr>
    <th scope="row">Bob</th>
    <td>35</td>
  </tr>
</table>

How Silktide tests this

  1. Find every <th> heading cell on each page.
  2. Report each one whose scope attribute is missing or not one of row, col, rowgroup, or colgroup.

Troubleshooting

My simple table works fine without scopes

For a table with a single top row of headings, browsers and screen readers can usually infer the structure. Explicit scopes still remove all ambiguity, cost nothing, and protect you when the table is later made more complex, so Silktide asks for them on every heading cell. If you decide a particular table is fine as it is, you can the finding.

Learn more

Last updated

Was this page helpful?

Table heading scopes | Silktide Help