Table
2 Table variations from the W3C ARIA Authoring Practices Guide.
Table
A static ARIA table assembled from ordinary div and span elements. It does not use grid keyboard interaction.
Example
Name Role
Alex Designer
Sam Engineer
Keyboard interaction
Read the table with normal screen-reader table navigation. Static cells are not added to the Tab sequence.
Example HTML
<axxy-scope>
<div role="table" aria-label="Team directory">
<div role="row">
<span role="columnheader">Name</span>
<span role="columnheader">Role</span>
</div>
<div role="row">
<span role="cell">Alex</span>
<span role="cell">Designer</span>
</div>
<div role="row">
<span role="cell">Sam</span>
<span role="cell">Engineer</span>
</div>
</div>
</axxy-scope>Table (Sortable)
A native table with sortable text and numeric columns. Only the sorted header carries aria-sort.
Example
| Team | ||
|---|---|---|
| Sam | 12 | Engineering |
| Alex | 3 | Design |
| Lee | 27 | Research |
Keyboard interaction
Tab reaches sort buttons. Enter or Space reverses the selected column’s order.
Events
Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.
axxy-sort— Dispatched on sortable tables when a column header is activated. (target:<table>, detail:{ column: number, ascending: boolean })
Example HTML
<axxy-scope>
<table>
<caption>Team directory — activate a column heading to sort.</caption>
<thead>
<tr>
<th scope="col">
<button type="button">Name</button>
</th>
<th scope="col">
<button type="button">Score</button>
</th>
<th scope="col">Team</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sam</td>
<td>12</td>
<td>Engineering</td>
</tr>
<tr>
<td>Alex</td>
<td>3</td>
<td>Design</td>
</tr>
<tr>
<td>Lee</td>
<td>27</td>
<td>Research</td>
</tr>
</tbody>
</table>
</axxy-scope>