AUDIO
Source snapshot · 11 November 2026

Fixed hierarchical tree selection

Methods and callbacks

setExpanded(indices, {notify=false}) validates a unique branch-only bounded index set atomically. setSelected(indices, {notify=false}) validates a unique index set (at most one in single mode), with unavailable-admission rules above. setActive(index, {focus=false}) requires current visible eligibility and changes no selection. They return false for invalid arguments, busy transitions, disposed ownership or unsuccessful requested focus. Effective no-ops do not notify. Valid programmatic models can succeed while all items are unavailable.

selection() returns a frozen snapshot with frozen selectedIndices, selectedIds, unavailableSelectedIds (each at most 256), and activeIndex. expansion() returns frozen expandedIndices/expandedIds of branch item IDs and activeIndex. They return null after disposal or invalid fixed ownership. activeIndex() and lastError() are read-only; refresh() reasserts the owned profile, reconciles eligibility and returns whether root keyboard focus is available. dispose() is idempotent.

Only changed selected state calls onSelection, only changed expansion calls onExpansion, and only when notification is enabled. Input notifies automatically; programmatic updates default to quiet. Callback snapshots add source=keyboard, pointer or programmatic. Quiet active fallback never sends either callback. One transition guard rejects callback/focus reentry; disposal stays legal. Post-focus and post-callback ownership, eligibility and required focus are revalidated. A host/consumer callback can retire or redirect focus after an accepted change: the method reports failure but cannot roll back an already committed/notified model. A throwing callback retains committed state and reports Callback. Focus exceptions report Focus; original-document/profile failure reports Ownership and retires; unavailable focus/input reports Unavailable. Invalid arguments do not replace the previous diagnostic. Native handlers do not propagate callback exceptions.

Original-document mutation observation reasserts owned roles/names/tabindex and reconciles state. Fixed member/order/ID/native profile removal/adoption, new nested focusable elements or descendant scan overflow retires. Queued disposed observer work is inert. Stylesheet/geometry changes outside observation require explicit refresh. No timer-polled focus trap or global focus movement is used.