Module a11y
Expand description
Accessibility semantic model: the data layer. Defines the
toolkit-ergonomic semantic types — Role, AccessNode,
AccessState, and Action — that every
Widget describes itself with via
Widget::accessibility.
Deliberately a thin convenience layer: the export layer maps these onto AccessKit’s far richer schema (182 roles, 22 actions) and exports the assembled tree over AT-SPI2, while an in-process channel feeds the same nodes to the built-in screen reader. A widget author implements semantics once with a handful of variants.
Everything here is pure data, no behaviour — no D-Bus, no AccessKit
dependency. Each field maps cleanly onto an AccessKit concept (e.g. our
AccessState::multiline + Role::TextInput →
accesskit::Role::MultilineTextInput).
Structs§
- A11y
Settings - Stored in the per-user settings CRDT and mirrored into spawned sandboxes
via
TILO_A11Y_*env vars. Defaults are all-off so existing single-user setups are unaffected until a user opts in. - Access
Bounds - Serializable absolute logical-pixel geometry for a synthetic
AccessNode. This mirrorsRectwithout requiring widget authors to depend on its serialization feature. - Access
Node - The per-widget local accessibility semantics returned by
Widget::accessibility;name/descriptionmust already be FTL-resolved strings (viai18n!), not translation keys, since AccessKit/AT-SPI consume final text. - Access
State - Tri-state fields use
Option<bool>whereNonemeans “the state does not apply” (e.g. aRole::Buttonis neverchecked) — matching ARIA’saria-checked="false"vs. absent distinction. - Accessible
Text Selection - Editable-text selection in the widget’s native UTF-8 document space.
Enums§
- Accessibility
Request - A change to the person’s accessibility preferences that a control asked for, such as the sign-in screen’s larger-text or high-contrast toggle. The host applies it to the whole window, exactly as the matching system preference would.
- Action
- Requested by an assistive technology or the built-in screen reader.
Consumed by the future
Widget::perform_actionhook, routed through the same CRDT-mutating path ashandle_event. - Politeness
- How urgently a live region narrates its own update without moving focus — a toast appearing, a status line changing.
- Role
- A thin subset of AccessKit’s 182 roles covering the widgets the toolkit
supports; unknown/rare cases fall back to
Role::Generic.
Functions§
- contrast_
ratio - WCAG 2.1 contrast ratio between two colours, in
[1.0, 21.0](1.0 = same luminance, 21.0 = black on white). WCAG AA body text wants ≥ 4.5:1; AAA wants ≥ 7:1. - hash_
key - Hash any hashable value into the
u64key space used byAccessNode::key. - relative_
luminance - WCAG 2.1 relative luminance of an sRGB colour, in
[0.0, 1.0]. Alpha is ignored (colours are assumed opaque for contrast purposes). - texts
- Every name and value
rootand its descendants expose to assistive technology, depth first.