Layout table has an improper role
table-layout-improper-role
- Rule ID:
- table-layout-improper-role
- User Impact:
- Moderate
- WCAG :
- 1.3.1.b
Rule
Layout tables must have a "presentation"
or "none"
role on the <table>
element.
Background
The <table>
element is intended to be used to present tabular data, but because it automatically arranges its contents into a grid, developers are sometimes tempted to use it to create a "quick-and-dirty" layout grid for content that is not actually tabular data.
If you do choose to use a table for layout purposes, you must take care to override the inherent semantics of the table or else assistive technologies will treat the layout grid as a data table, which creates an extremely confusing user experience.
Using a <table>
element to create a layout grid is an antiquated practice that can easily lead to reading-order issues. It should be avoided unless you have a good reason to do it. Instead, use CSS to create layout grids with more flexibility with fewer potential downsides.
How to Fix
Add a role of "presentation"
or "none"
to the <table>
element.
Section 1 Title | Section 1 content ... |
Section 2 Title | Section 2 content ... |
<table role="presentation">
<tbody>
<tr>
<td>Section 1 Title</td>
<td>Section 1 content ...</td>
</tr>
<tr>
<td>Section 2 Title</td>
<td>Section 2 content ...</td>
</tr>
</tbody>
</table>