Keyboard navigation of a tree (a file explorer, a page's layers, a nested
menu), after the WAI-ARIA tree pattern: one tab stop, Up and Down through the
rows that are showing, Right to open a row or step into it, Left to close it
or step out to its parent, Home and End to the first and last row.
The Model slice is the current row's id and which rows are open. Openness is
stored as the rows toggled away from a default, so a layers panel that
starts with everything open and a file tree that starts closed are the same
bundle with a different openByDefault, and neither stores every row.
Which rows exist is the view's to say, each with its parent, in tree order.
What a key does is a pure function of those rows and the Model; the Behavior
wires it to the slots and writes the tree's ARIA attributes.
Wires a placed TreeNavigation to the slots. The container's keys move focus
to the row they pick, or open or close the current row with focus left where
it is. Each showing row gets its id, role="treeitem", aria-level (and
the same level as --fk-tree-level, so one calc indents any depth),
aria-posinset, aria-setsize, aria-expanded when it has children,
aria-disabled when disabled, a roving tabindex, and OnFocus reporting
it current. Every handled key is default-prevented.
What a key does from the current row, over the rows that are showing, or
undefined when it is not a key the tree handles. Disabled rows are stepped
over. With nothing current, Down and Home land on the first row, Up and End
on the last. Right and Left swap under rtl.
The rows that are showing: every row whose ancestors are all open, with its
level and its place among its siblings. A row whose parent is not a row is
treated as top-level.