Table Header Attribute Refers to Invalid Element
| Field | Value |
|---|---|
| Rule code | Table_Header_Invalid |
| WCAG conformance level | A |
| WCAG success criterion | 1.3.1 Info and Relationships |
| Must be fixed at source | No |
Description
Data cells in tables can use the headers attribute to associate with one or more tableheader elements, ensuring correct relationships between header and data cells. We detected that a data cell's headers attribute refers to an element that is either missing, outside the table, or incorrectly assigned (e.g., referring to another td instead of a valid th element). Referring to elements outside the table, or to non-header elements, creates navigational issues for users utilizing screen readers and other assistive technologies to browse table contents.
How to fix
Ensure that the headers attribute in table data cells refers only to valid th elements within the same table.
<table>
<thead>
<tr>
<th id="header1">Projects</th>
<th id="header2">Objective</th>
</tr>
</thead>
<tbody>
<tr>
<td headers="header1">15%</td>
<td headers="header2">10%</td>
</tr>
</tbody>
</table>