Ensure table headers have discernible text
The empty-table-header
rule checks that all table header elements
(<th>
,
role="columnheader"
, or
role="rowheader"
) contain visible text that describes their purpose.
What is being tested?
The rule ensures that all table header cells have meaningful, visible text so that both sighted users and screen reader users understand the structure and meaning of the table.
Correct markup examples
<table> <tr> <th>Student Name</th> </tr> </table>
Incorrect markup examples
<table> <tr> <th></th> </tr> </table> <table> <tr> <th aria-label="Student Name"></th> </tr> </table>
Why it matters
Table headers help both sighted users and screen reader users understand the relationships between rows and columns.
If a table header is empty or only uses
aria-label
without visible text, screen readers may miss critical context, and sighted users may be confused.
If an element is not meant to be a header, you should use
<td>
instead of
<th>
.
Best practices
- Always provide meaningful, visible text in header cells.
- Use
<th>
only for header cells, not for layout or decorative purposes. - Ensure headers help communicate table relationships, improving usability for all users.
Other Rules
Interested in other web accessibility rules? Please see these other rules: