Tables
Use a real caption
- Rule:
table-fake-caption - Severity: Serious
- WCAG level A
Why it matters
A first row styled to look like a title is read as a data cell. The table gets no caption, and the row corrupts the column structure for everyone reading it cell by cell.
How to fix it
- Move the text into a <caption> element as the first child of the <table>.
- Style the caption with CSS if it needs to look like the old row.
- Remove the spanning row afterwards so the column count is honest.
In markup
<table>
<tr><td colspan="3"><strong>Q3 revenue</strong></td></tr>
<tr><th>Region</th><th>Q3</th><th>Q4</th></tr>
</table><table>
<caption>Q3 revenue</caption>
<tr><th>Region</th><th>Q3</th><th>Q4</th></tr>
</table>The requirement behind it
This rule is one way of failing the following WCAG 2.2 success criteria. The W3C, which writes the standard, explains each of them:
- 1.3.1 Info and Relationships (opens in new tab) — WCAG level A
Further reading
Deque University on table-fake-caption (opens in new tab)
Deque maintains axe-core, the open-source engine our scanner runs. Their page documents the rule as the engine implements it.
Automated checks find failures a browser can prove. They cannot judge whether a caption is accurate, whether an alt text is useful, or whether a page can be operated end to end with a keyboard — those need a person.