All <th> elements and elements with role="columnheader" or role="rowheader" must have data cells they describe

th-has-data-cells
axe-core
3.0
Serious

Learn Web Accessibility

Subscribe to our extensive curriculum of online self-paced courses.

Compliance Data & Impact

  • Blindness
  • Deafblindness
  • WCAG 2.1 (A): MUST
  • WCAG 2.0 (A): MUST
  • Section 508: MUST
  • Not specified or not applicable
  • Not specified or not applicable

How to Fix the Problem

Ensure that each table header in a data table refers to data cells so that each header cell that is used is actually a header of something.

In other words, the <th> element must have associated data cells.

If headers attributes exist, ensure that they reference elements with text available to screen readers.

  • The <th> element must not use the headers attribute
  • <th> elements should only be used when there is a single row and single column of headers
  • <th> elements must use the scope attribute

Example: th with no data

In the following table, you will notice the <th> with the value '10 km' is acting as a header for a column, but that column's cells have no data

Greensprings Running Club Personal Bests
Name 1 mile 5 km 10 km
Mary 8:32 28:04
Betsy 7:43 26:47
Matt 7:55 27:29
Todd 7:01 24:21

Why this is Important

Screen readers have a specific way of announcing tables. When tables are not properly marked up, this creates the opportunity for confusing or inaccurate screen reader output.

When tables are not marked up semantically and do not have the correct header structure, screen reader users cannot properly perceive visually the relationships between the cells and their contents.

Rule Description

Data table markup can be tedious and confusing. It is important that it is done semantically and with the correct header structure. Screen readers have a number of features to make table navigation easier, but tables must be marked up accurately for these features to work properly.

The Algorithm (in simple terms)

Checks that data tables are marked up so that each header cell is used as a header of something.

Resources

Find the complete list of axe rules online.