Semantics
- The rows are a
<ul>of<li>s, withrole="list"written out, becauselist-style: nonemakes Safari drop the list role and with it the "list, 5 items" a screen reader announces. - The list is named by its title through
aria-labelledby. Without a title, passaria-label. - The title is a real heading (
h3by default,headingLevelto change it), so the list appears in a screen reader's list of headings. - A row that navigates is an
<a>(or a<RouterLink>), inside its<li>. A row that acts is an element withrole="button", inside its<li>. The list item stays a list item either way. currentsetsaria-current="page"on a link andaria-current="true"on anything else.
Keyboard
| Key | Does |
|---|---|
| Tab | Moves to the next row that acts |
| Enter | Follows a link row, activates a button row |
| Space | Activates a button row |
Rows that neither navigate nor act are not in the tab order.
What not to put in a row
- A control in
#trailingof a row that acts. A button inside a link is two targets in one, and neither a keyboard nor a screen reader can reach the inner one reliably. If a row needs its own actions, it is a table row: useNbDataTable. - Colour as the only signal. A red count says nothing to someone who cannot see red. Put the state in words in a badge, per Status indicators.
Touch
On a phone touch screen, rows that act are at least 44px tall.