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
<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.
- ARIA attribute is defined in WAI-ARIAA tool can check this
- ARIA state or property has valid valueA tool can check this
- Element with role attribute has required states and propertiesA tool can check this
- Form field has non-empty accessible nameA tool can check this
- Headers attribute specified on a cell refers to cells in the same table elementA tool can check this
- Role attribute has valid valueA tool can check this
- ARIA global properties not used where prohibitedA tool can check this
- ARIA required context roleA tool can check this
- ARIA required owned elementsA tool can check this
- ARIA state or property is permittedA tool can check this
- Table header cell has assigned cellsA tool can check this
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.
- ARIA11sufficientAdd landmarks so users can skip around
- ARIA12sufficientUse role=heading when h1-h6 is impossible
- ARIA13sufficientName repeated landmarks so they are distinguishable
- ARIA16sufficientName controls from visible text with aria-labelledby
- ARIA17sufficientGroup related form fields with ARIA roles
- ARIA20sufficientMark leftover page areas with role=region
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.