Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

A11yGroupId

Accessibility policies for SceneView.

Public types

KindName
structA11yGroupId — Opaque identifier for a logical AT group declared via Scene::add_a11y_group
enumA11yNode — Address of a node in the parallel logical AT tree
enumA11yRelation — AT relationship kind, applied via Scene::add_a11y_relation
structA11yCategory — App-defined category tag for AT rotor / quick-nav navigation
structA11yGroupBuilder — Builder for an A11yGroup
structA11yGroup — A logical AT group
enumA11yMode — AT-emission strategy for SceneView
enumA11yOffScreenMode — Off-screen visibility policy for the AT walker

Public functions

A11yGroupId

ReturnsFunction
Methods
u64as_u64()

A11yCategory

A11yGroupBuilder

A11yGroup

ReturnsFunction
Methods
A11yGroupIdid()
Option<String>label()
accesskit::Rolerole()
Associated functions
A11yGroupBuilderbuilder()

A11yOffScreenMode

ReturnsFunction
Methods
Option<Rect>at_visible_region(visible_scene_region: Rect)

Detailed description

Two layers cooperate. The visual-default path emits AT nodes for every visible heavyweight widget and every visible lightweight item with a role and a scene-space rectangle, gated by an A11yOffScreenMode policy that decides which off-viewport items are still announced. (Scene-space, with the camera declared once as an AccessKit node transform above them — see crates/teksilo-scene/src/view/a11y_impl.rs.) The logical-structural API (groups, parents, relations, auto-graft, custom focus callbacks) layers over the top — see docs/teksilo-scene-a11y.md for the full picture.

Defaults are chosen so a quick prototype is accessible out of the box: heavyweight widgets emit normally, lightweight items get synthetic nodes, Tab cycles in reading order. Apps shape the reading experience by declaring A11yGroups, reparenting nodes, and installing a focus-order callback.

API reference

📖 Full rustdoc API for this module

pub struct A11yGroupId

Import: use teksilo_scene::A11yGroupId; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

Opaque identifier for a logical AT group declared via Scene::add_a11y_group. Stable across the lifetime of the process; safe to hash, compare, store.

#![allow(unused)]
fn main() {
pub struct A11yGroupId(pub(crate) u64);
}

Methods

pub fn as_u64(self) -> u64

Raw numeric value. Used by the AT walker to derive a synthetic NodeId via synthetic_node_id(scene_view_id, id.as_u64(), SyntheticKind::SceneGroup).

pub enum A11yNode

Import: use teksilo_scene::A11yNode; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

Address of a node in the parallel logical AT tree. Lets apps uniformly target scene entries, virtual groups, and ad-hoc widgets when declaring relationships, parents, or rotor categories.

#![allow(unused)]
fn main() {
pub enum A11yNode { /* variants */ }
}

Variants

  • Item (ItemId) — Any entry in the scene — lightweight SceneItem or heavyweight Widget added via Scene::add_widget. The walker discriminates by entry kind: lightweight items get a synthetic SyntheticKind::SceneItem AT node; heavyweight items get auto-grafted via the framework redirect hook, landing the real widget's NodeId under the declared parent.
  • Group (A11yGroupId) — A virtual A11yGroup declared via Scene::add_a11y_group.
  • Widget (WidgetId) — A real interactive widget addressed by its arena WidgetId. Use this to relocate widgets that aren't Scene::add_widget-managed — typically a descendant of a heavyweight scene item that should logically belong elsewhere (a global ComboBox nested visually inside a Scene card but logically under a top-level "Tools" group). For widgets you added via Scene::add_widget, prefer A11yNode::Item(item_id) — the walker handles the heavyweight-item auto-graft for you.

pub enum A11yRelation

Import: use teksilo_scene::A11yRelation; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

AT relationship kind, applied via Scene::add_a11y_relation. Maps to AccessKit's relationship arrays.

#![allow(unused)]
fn main() {
pub enum A11yRelation { /* variants */ }
}

Variants

  • Controls — from controls to (e.g. a button that opens a menu).
  • DescribedBy — from is described by to (cross-item annotation).
  • LabelledBy — from is labelled by to (cross-item label).
  • FlowTo — Logical flow direction — many node-graph editors use this so VoiceOver / NVDA "next item" follows data-flow order rather than reading order.

pub struct A11yCategory

Import: use teksilo_scene::A11yCategory; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

App-defined category tag for AT rotor / quick-nav navigation. Surfaced to AT clients that support categorized navigation (VoiceOver rotor on macOS, NVDA quick-nav). Apps coin their own tag values like "node", "connector", "comment".

#![allow(unused)]
fn main() {
pub struct A11yCategory(pub std::borrow::Cow<'static, str>);
}

Methods

pub fn new(name: impl Into<std::borrow::Cow<'static, str>>) -> Self

Create a new category tag from a string or &'static str. Accepts "node", "connector", String, or any Cow<'static, str>.

pub struct A11yGroupBuilder

Import: use teksilo_scene::A11yGroupBuilder; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

Builder for an A11yGroup. Returned by A11yGroup::builder; consumed by Scene::add_a11y_group.

let act_one = scene.add_a11y_group(
    A11yGroup::builder()
        .label("Act 1")
        .role(accesskit::Role::Group)
);
scene.set_a11y_parent(A11yNode::Item(scene_card), Some(A11yNode::Group(act_one)));
#![allow(unused)]
fn main() {
pub struct A11yGroupBuilder { /* fields */ }
}

Methods

pub fn label(mut self, label: impl Into<LocalizedString>) -> Self

Human-readable label for the group, announced when AT clients land on the group node. Accepts anything convertible into LocalizedString.

pub fn role(mut self, role: accesskit::Role) -> Self

Override the AccessKit role. Default: Role::Group. Apps commonly use Role::Region for landmark-style groups.

pub struct A11yGroup

Import: use teksilo_scene::A11yGroup; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

A logical AT group. Pure structure — no visual counterpart, no hit-test, no paint. Declares AT-shape that diverges from visual scene layout (Acts containing Scene cards, Subgraphs containing Nodes, Layers containing Components).

#![allow(unused)]
fn main() {
pub struct A11yGroup { /* fields */ }
}

Methods

pub fn builder() -> A11yGroupBuilder

A fresh builder for a logical group. Default role is Role::Group; override with A11yGroupBuilder::role.

pub fn id(&self) -> A11yGroupId

The group's id. Stable for the lifetime of the process.

pub fn label(&self) -> Option<String>

The label set on the builder, if any.

pub fn role(&self) -> accesskit::Role

The role set on the builder. Default Role::Group.

pub enum A11yMode

Import: use teksilo_scene::A11yMode; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

AT-emission strategy for SceneView. Decides whether items / widgets that have not been placed in the app-declared logical tree appear in the AT tree by default, or are suppressed.

Pick Cooperative when the visual scene layout is a sensible AT structure for your app (charts, dashboards, simple maps). Pick StrictlyParallel when AT shape diverges meaningfully from visual layout — story corkboards (Acts → Scene cards), node-graph editors (Subgraphs → Nodes → Ports), CAD canvases (Layers → Components). Apps in this category typically declare every AT edge anyway, so the default visual-emission becomes noise.

#![allow(unused)]
fn main() {
pub enum A11yMode { /* variants */ }
}

Variants

  • Cooperative — Default. Visual is the AT structure unless overridden. Items inside the off-screen-mode policy emit as direct AT children of SceneView (or their declared logical parent if set_a11y_parent placed them). Heavyweight widgets emit through the arena walker as natural descendants of SceneView. The logical-tree machinery layers on top.
  • StrictlyParallel — AT structure is purely declared. Items are emitted only if the app placed them in the logical tree via Scene::set_a11y_parent. Heavyweight widgets still emit (they own focus / interaction state the AT layer can't suppress) but their parent in the AT tree is the declared logical parent if any, else SceneView itself. Use this when your app's AT shape is fundamentally different from its visual layout — declaring every node once is cheaper than overriding the visual default for every node.

pub enum A11yOffScreenMode

Import: use teksilo_scene::A11yOffScreenMode; — add teksilo-scene to [dependencies]: teksilo does not re-export it.

Off-screen visibility policy for the AT walker. Decides which scene items get emitted as synthetic AT nodes per AT-rebuild.

ViewportPlusN { n: 1 } is the default: an item appears in the AT tree if its bounds_in_scene intersects viewport ∪ (1× viewport-grown-rect). That keeps the tree close to "what the user can interact with right now" while letting screen-reader users discover items just outside the visible region by jumping to the next/prev — at which point SceneView::ensure_visible pans the view to bring the focused item into view.

#![allow(unused)]
fn main() {
pub enum A11yOffScreenMode { /* variants */ }
}

Variants

  • AllItems — Emit every item in the scene as a synthetic AT node. Heaviest mode — appropriate for small scenes (< ~500 items) where AT users want a complete table of contents.
  • ViewportPlusN { n: u32 } — Emit items inside the viewport plus an n × viewport-grown margin around it. n = 0 collapses to "viewport only" with the same allocation pattern as ViewportOnly. n = 1 is the default — gives screen-reader users a one-screen "lookahead" to navigate without ensure_visible round-tripping through pan animation.
  • ViewportOnly — Strict: only items intersecting the current viewport. Pairs with apps that have very large scenes where listing off-screen content would overwhelm AT clients.

Methods

pub fn at_visible_region(&self, visible_scene_region: Rect) -> Option<Rect>

Compute the scene-coord rectangle a given mode considers "AT-visible" given the current visible scene region. Used by SceneView::accessibility as the spatial-index query rect. AllItems returns None so the caller knows to bypass the query and emit every item.