Accessibility
Tree, TreeMode, TreeSelectionMode from @prepared911/ui/tree.
ul is role="tree", each row's li is a treeitem, and each nested list is a group. The tree takes its name from aria-label or aria-labelledby.aria-labelledby, so the rows of a nested group never leak into its name. Secondary text and accessories (counter, badge, status text) are its description.aria-level, aria-posinset and aria-setsize. aria-expanded is set only on rows with children. With selection on, every treeitem carries aria-selected="true" or "false", and a multiple-selection tree is aria-multiselectable. A disabled row sets aria-disabled; a loading row sets aria-busy.| Key | Action |
|---|---|
| Up, Down | Previous or next visible row. |
| Right (Left in right-to-left) | Expand a collapsed parent; on an expanded parent, move to its first enabled child. |
| Left (Right in right-to-left) | Collapse an expanded parent; otherwise move to the parent. |
| Home, End | First or last visible enabled row. |
| Enter | Activate the row: run onClick, follow href, select it, or toggle a plain parent. |
| Space | Select the row, or toggle it in a multiple-selection tree. |
* | Expand every collapsed sibling of the row. |
| Letters | Move to the next visible row whose label starts with what you typed. |
onClick or href.href renders a link that is not a tab stop; Enter on the row follows it. A click on the link returns focus to the row.inert.compact unmounts the row that has focus, focus moves to its top-level ancestor. The same applies when new items remove the focused row; focus held outside the tree is left alone.nav (or another landmark) and name it.list role. A disclosure is a button with aria-expanded and, while its list is mounted, aria-controls. A link row marks the current page with aria-current="page".toggleLabel and the row label (for example, "Toggle Reports").inert, so its links are not in the order.prefers-reduced-motion: reduce the height, the turn and the glide change at once, and the fades remain.CanvasText there.