Accessibility
a11y/table-caption
A data table has a name, from a caption element or aria-labelledby pointing at the heading above it.
minormanualWCAG 1.3.1 · Afe-a11y-tables
Why
Screen reader users can list the tables on a page and jump between them. Without a name they hear "table, 5 columns, 12 rows" for each one and must read cells to find the right table.
Fix
Add <caption> as the first child of <table> (it can be visually hidden if a heading already shows the title), or point aria-labelledby at the heading that introduces the table.
Examples
<h2 id="orders-title">Recent orders</h2>
<table aria-labelledby="orders-title">…</table>Sources
Facts
- Id
a11y/table-caption- Severity
- minor
- Check
- manual a person reviews it; the report lists it as a checklist
- Applies to
htmlangularvuesvelteastrojsx- WCAG 2.2
- 1.3.1, level A
- Taught by the skill
fe-a11y-tablesData tables- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain a11y/table-caption