Accessibility
- Renders a real
<table>with<th scope="col">header cells and a<colgroup>for widths. - Sortable headers are
<button>s inside the<th>and exposearia-sort(ascending/descending/none), so sorting works with keyboard and screen readers. - Selection controls are labelled checkboxes / radios; selected rows carry
aria-selected. - The table exposes
aria-busywhile loading, and usesaria-label(fromariaLabelortitle). - Clickable rows (with a
row-clicklistener) are focusable withtabindex="0"and keep their native row role, so the table is still a table and a screen reader names the focused row from its cells. Enter and Space activate the row, and a key pressed on a control inside the row (a checkbox, a row action, a link in a cell) belongs to that control. The row draws a 2px--nb-c-focus-ringoutline on keyboard focus. - Expandable rows: the toggle is a
<button>witharia-expanded, and while the row is open,aria-controlspoints at the detail. The detail is aregioninside a full-width cell, so the cell stays a table cell. The toggle and the region are both named after the row's title column (Details for Ada Lovelace), the same column a phone card uses as its title, so a screen reader hears whose details they are. The header cell of the toggle column has a visually hidden "Row details" label. Focus stays on the toggle when the row opens or closes. - Stacked on a phone, the table, rows and cells carry explicit
table,rowandcellroles, because the change ofdisplaythat makes the cards would otherwise strip the table semantics in some browsers.