Skip to content

a11y: roving tabIndex in ComponentTree for large fiber trees (WCAG 2.1.1) #34

Description

@jamilagibson

Context

The current ComponentTree gives tabIndex={0} to every visible node header, meaning Tab cycles through all visible nodes. The ARIA Authoring Practices Guide (APG) recommends roving tabIndex for tree widgets — only the focused node has tabIndex={0}; all others are tabIndex={-1}. Arrow keys move focus within the tree.

This is acceptable at current scale (small demo app Fiber tree). It becomes a usability problem when Will's full fiber tree serialization lands and node counts grow significantly.

Implementation

  • Only the currently focused node has tabIndex={0}; siblings and cousins get tabIndex={-1}
  • ArrowDown / ArrowUp move focus to the next/previous visible node
  • ArrowRight expands and moves focus to first child
  • ArrowLeft collapses or moves focus to parent

Acceptance criteria

  • Roving tabIndex implemented per APG tree widget pattern
  • Tab enters the tree at the last focused node (or root if first visit)
  • Tab exits the tree in one keystroke
  • Arrow key navigation covers all visible nodes
  • Existing onKeyDown expand/collapse behavior preserved
  • ACCESSIBILITY.md updated

References

  • Decision 18 in CLAUDE.md — APG tree widget pattern and roving tabIndex known improvement

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityWCAG compliance, ARIA, keyboard nav, contrastgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions