Skip to content

The five rail sections have no tab stop: TreeRow derives the roving tabindex from aria-selected, so a tree with nothing selected cannot be entered from the keyboard #102

Closed

Description

@Code4me2

Measured 2026-09-01 on main + #40 (5dc517b) + #41 (3adc8e3) merged, in a live jsdom root (renderToStaticMarkup cannot see the store — useWorkspace's server snapshot is DEFAULT_STATE, which is the trap #41's own PR notes call out).

What happens

TreeRow publishes the tree pattern's roving tabindex off the selection flag:

// system/TreeRow.tsx:130-134
<li
  role="treeitem"
  aria-selected={selected}
  tabIndex={selected ? 0 : -1}

ProjectSectionList hard-codes selected={false} on all five rows, because a section is a disclosure and not a selection:

// rail/ProjectTree.tsx:153-157
<TreeRow
  key={id}
  depth={0}
  selected={false}
  expanded={expanded}

So that role="tree" widget contains five treeitems and zero elements with tabindex="0". Tab skips all five. Arrow keys cannot rescue it: Tree's handler bails on index === -1 (TreeRow.tsx:50), and index is found from document.activeElement, so the arrows only work once focus is already inside the <ul> — and nothing can put it there. The <ul role="tree"> itself has no tabindex; the inner .row div has none; the twisty is a <span aria-hidden="true" data-tree-toggle> with none.

Analyses, Docs, Globals, Imports and Materials cannot be focused or expanded from the keyboard in any state, at any width above 1024px. They are pointer-only controls that announce themselves to a screen reader as five collapsed branches.

Measured

Live root, ProjectTree with the 5-part fixture, counting [role="treeitem"][tabindex="0"] per widget:

workspace state role="tree" widgets treeitems tab stops which
part = null 2 10 0 —
part = "tread" (built, 2 geometries) 2 12 1 tread only

In the second row every one of analyses docs globals imports materials reads tabindex="-1" aria-selected="false" aria-expanded="false", and the one tab stop is inside the parts <ul>, from which the arrows cannot leave (that boundary is #65).

The part = null row is a transient, not the bug: App.tsx:54-62's DefaultPart selects the project's first part once GET /parts resolves, which is the only reason the parts tree has an entry at all. The sections tree has no equivalent, and never gets one. Its emptiness is structural, not a race.

Why this is the primitive's bug and not the caller's

aria-selected and "holds the tree's tab stop" are two different facts and the ARIA tree pattern keeps them apart: it requires exactly one tabbable node per tree at all times, and that node is the tree's focus holder, which may be any row — selection is a separate, optional state. TreeRow fuses them, so the primitive is only correct for trees that always have a selected row. A disclosure-only tree is a legitimate tree and this one is in the shipped rail.

That also means the fix is not "pass selected={true} to Analyses", which would be a lie in the accessibility tree about what is selected. Tree should own a focus-holder index (defaulting to the first row, or to the selected row when there is one) and hand tabIndex={0} to that row, leaving aria-selected to mean selection.

Expected

§3.13.4: "the rail tree implements arrow-key navigation with role="tree"/treeitem/aria-expanded" — a widget with no tab stop implements none of it from the keyboard. §4.7's TreeRow entry lists "Retires: … a tree with no keyboard navigation", and TreeRow.tsx's own header calls the shipped defect "an ARIA role claiming a keyboard contract the code did not implement — worse than no role, because a screen-reader user is told to expect arrows that do nothing." Five rows currently reproduce that sentence exactly.

  • Every Tree has exactly one tabindex="0" row whenever it has any rows, with or without a selection.
  • Tab reaches the sections; ArrowUp/Down move among them; ArrowRight/Left expand and collapse; Home/End reach the ends.
  • aria-selected keeps meaning selected.

Repro

Load the operator at 1280×800 and Tab from the header. Focus passes through the parts tree's one selected row and then leaves the rail entirely — the five section rows are never reached. There is no keystroke that opens Analyses.

What this is NOT

Web-only. No CAM, no viewport work, no #14/#32.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions