List
catnip-list applies listbox or menu semantics to its body and rows, but keyboard logic stays in the parent. You choose the role, provide an accessible name when there is no visible title, and manage focus between rows.
Keyboard
- Keyboard logic stays in the parent (see Dropdown for a reference implementation).
- For listbox, row controls use
tabindex="-1"; move focus with a roving tabindex oraria-activedescendantin the parent. - For listbox roving focus /
aria-activedescendant, setlistItemIdon the active row andactiveoncatnip-list-item. - Parent keyboard logic should skip dividers when moving
active/aria-activedescendant.
Screen readers
| Part | Semantics |
|---|---|
| List | listRole on the list: listbox for pickers, menu for action menus. |
| Rows | option rows in a listbox, menuitem rows in a menu. |
| Dividers | catnip-divider with default decorative, so separators do not affect option counts. |
What you own
- Role: Match
listRoleon the list to semantics:listbox+optionrows, ormenu+menuitemrows. - Name: Provide
listAriaLabelorariaLabelledbywhen there is no visible title. - Focus: Implement the keyboard logic and focus movement in the parent (see Keyboard).
- Dividers: Keep dividers decorative (default) inside listbox/menu panels.
- Danger rows: Set
intent="danger"on the item; do not rely on colour alone.