Table does not have a caption
| Field | Value |
|---|---|
| Rule code | Table_Caption_Missing |
| WCAG conformance level | A |
| WCAG success criterion | 1.3.1 Info and Relationships |
| Must be fixed at source | No |
Description
Each table needs a caption to explain its purpose. We detected a table without a caption element provided. If a table is not labelled with a caption, it is unclear what information it might contain. People using assistive tools rely on a provided caption to acknowledge the contents and purpose of a table component.
How to fix
Add a <caption> element to each table. The caption should be a brief description of what the table contains.
<table>
<caption>Personal favorite foods</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Favorite food</th>
<th scope="col">Second favorite food</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Alice</th>
<td>tacos</td>
<td>apple pie</td>
</tr>
<tr>
<th scope="row">Brenda</th>
<td>ice cream</td>
<td>pasta</td>
</tr>
<tr>
<th scope="row">Chaz</th>
<td>stir fry</td>
<td>hummus</td>
</tr>
</tbody>
</table>