Web Accessibility & WCAG (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Accessible Data Tables: Structure and Headers Association.
senior LevelCode ExampleSystem Design
In Simple Words: Screen readers cannot convey tabular data without proper markup:
- Use
<caption>to describe the table's purpose. - Use
<th>withscope="col"for column headers andscope="row"for row headers. - For complex multi-tier tables, link cells to headers explicitly using
headers="header-id".
html
<table>
<caption>Quarterly Revenue by Region (in USD Millions)</caption>
<thead>
<tr>
<th scope="col">Region</th>
<th scope="col">Q1</th>
<th scope="col">Q2</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">North America</th>
<td>$45.2</td>
<td>$48.9</td>
</tr>
</tbody>
</table>