Skip to main content

Module a11y_tree

Module a11y_tree 

Expand description

The retained accessibility tree — a stable, frame-to-frame semantic model of the running UI.

The toolkit is immediate-mode: draw and accesskit_bridge::build_tree_update both re-derive a fresh tree each call, which is fine for pushing a whole tree at AccessKit but gives no stable identity or diff — nothing survives between frames. A SemanticTree is the retained counterpart: it keys nodes by a stable SemanticId and, on each refresh, diffs the freshly-walked UI against the previous frame, returning a TreeDelta while preserving identity for every node that recurs. This is the foundation an AT-SPI incremental push, a screen reader’s change narration, or an agent/CLI introspection layer builds on.

Each refresh assembles the tree from two sources, so a node carries both what it is and what you can do to it: the Widget::accessibility walk (roles/names/values/state, collapsing presentational widgets like the AccessKit bridge does) contributes generic verbs (focus, activate, …); the app’s resources() forest from the Tilo action model contributes SemanticActionKind::App affordances carrying the exact EncodedAction the click action sends — so invoking one by name drives the same replayable action through the one audited dispatch path, letting an assistive client operate the tree, not just read it.

The tree itself imports no AccessKit and no D-Bus — pure data plus a diff, unit-testable without a bus or a window.

Structs§

SemanticAction
One thing an assistive client can do to a SemanticNode, addressable by a stable name.
SemanticId
Stable identity of a semantic node, preserved across refresh as long as the backing widget or resource recurs.
SemanticNode
One node of the retained semantic tree.
SemanticTree
The retained accessibility tree. Persists node identity across frames and diffs each refresh against the previous.
TreeDelta
What changed between two refreshes. Ids that appear in neither list are present and byte-identical in both frames — their identity and content survived unchanged.

Enums§

SemanticActionKind
How a SemanticAction is carried out when invoked.