WCAG H63: Using the scope attribute to associate header cells and data cells

Rule ID:
wcag/h63
Category:
Accessibility
Standards:
  • WCAG 2.2 (A)
  • WCAG 2.1 (A)
  • WCAG 2.0 (A)

WCAG H63 requires header cells to have scope to associate with data cells.

Rule details

Examples of incorrect code for this rule:

<th></th>
error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at inline:1:2:
> 1 | <th></th>
    |  ^^


1 error found.

<!-- auto state cannot be set with a value -->
<th scope="auto"></th>
error: <th> element must have a valid scope attribute: row, col, rowgroup or colgroup (wcag/h63) at inline:2:12:
  1 | <!-- auto state cannot be set with a value -->
> 2 | <th scope="auto"></th>
    |            ^^^^


1 error found.

Examples of correct code for this rule:

<th scope="row"></th>

<th scope="col"></th>

<th scope="rowgroup"></th>

<th scope="colgroup"></th>

Markdown

If you are using content generated from Markdown consider disabling this rule as most markdown parsers does not generate <th> elements with the scope attribute.

Alternatively use a disable directive somewhere in the markdown file:

<!-- [html-validate-disable-block wcag/h63: markdown does not generate tables with scope attribute] -->

| Foo | Bar | Baz |
| --- | --- | --- |
| 1   | 2   | 3   |

Version history