Skip to main content
WCAGrules
Quick navigation

Add scope to table header cells

The scope attribute says which direction a header governs. scope=col for a header at the top of a column, scope=row for one at the start of a row. W3C lists it as sufficient for 1.3.1 Info and Relationships, and it also narrows the technique in a way most teams have backwards. For a plain table whose headers are in the first row or the first column, th on its own is enough and scope adds nothing you need. H63 is aimed at the middle case, the simple data table whose headers are not in the first row or column, which is where software would otherwise have to guess. There are four values rather than two, because rowgroup and colgroup govern a whole banded section instead of a single line. Above that sits H43, and W3C's advice before you reach for either is to see whether two simple tables would do the work of one hard one.

How we find it in an audit

Scanners flag th cells without scope and tables with no th at all, which is a useful inventory rather than a finding, because the commonest table shape passes without scope. What we check is direction. A scope=col sitting on a row header clears every automated test and hands users the wrong headers.

How affected users experience it

With scope in place, moving down a column gives you March, then 4,120, header then value, all the way to the bottom. Without it some screen readers guess, and a guess in a payroll table pairs a number with the wrong month while sounding exactly as confident as a correct one. Missing structure slows a person down. Wrong structure misinforms them.

Passes vs. fails

Passes: headings exist in the code. Fails: one flat wall of text.

Passes

<tr><td>1042</td><th scope="row">March</th><td>4,120</td></tr>

Fails

<tr><td>1042</td><th>March</th><td>4,120</td></tr>
<!-- the row header sits in the second column and claims no direction -->

How this gets tested

The W3C publishes test rules that define what a checker looks for here.

Other ways to satisfy this rule

52 guides on this site are filed under 1.3.1 Info and Relationships. W3C lists this one as sufficient for that rule when used for making information and relationships conveyed through presentation programmatically determinable, so the condition is part of the test rather than a footnote to it.

This guide is our interpretation of W3C technique H63: Using the scope attribute to associate header cells with data cells in data tables. W3C publishes its techniques as guidance rather than as the standard, and says so on every one of them. The success criterion is what conformance is measured against, and a technique is one documented way to meet it.

Go somewhere useful

Find tools, resources and your workspace.

29 destinations