Table
catnip-table, catnip-table-row, and catnip-table-cell expose table, row, cell, and column header roles, and sortable headers set aria-sort. You provide the table's name, the sort state, and accessible names for interactive content in cells.
Screen readers
| Part | Semantics |
|---|---|
Table (catnip-table) | role="table", named by tableAriaLabel. |
Row (catnip-table-row) | role="row". |
Cell (catnip-table-cell) | role="cell", or role="columnheader" when header is set. |
| Sortable header | aria-sort from activeSort (ascending / descending / none). |
| Interactive content in cells | Checkboxes, links, and buttons keep their own accessible names. |
What you own
Table name: Set
tableAriaLabel(HTML:table-aria-label) to the visible title text, or to a concise name when there is no visible title, including when a matching visible heading sits outside the component. The element withrole="table"is inside CatnipTable's shadow root, so external heading IDs cannot be resolved byariaLabelledbyacross the shadow boundary.html<h2>Events</h2> <catnip-table table-aria-label="Events"> <!-- rows --> </catnip-table>Sort state: Sortable headers only reflect
activeSort; you still own sort state and data order.Cell content: Give interactive content in cells its own accessible name, for example
checkboxAriaLabelon a row checkbox (see Selection).