Skip to main content

Module screen_reader

Module screen_reader 

Expand description

Built-in screen reader.

Narrates the semantic tree (crate::a11y::AccessNode) through an offline TTS stack. Focus changes interrupt the previous utterance; everything funnels through one [SpeechQueue], so a focus storm coalesces to the latest utterance instead of backing up.

describe is the pure core (AccessNode -> String, no I/O) — exhaustively unit-tested below as a role x state truth table.

A reading cursor can also walk the flattened accessible tree (DFS, presentational nodes collapsed) via ScreenReader::read_all / read_next / read_prev, synthetic children (a keyboard’s keys) included. The App hands it the retained tree’s order (ReadingItem) through the _in variants, and a finger explores it through ScreenReader::explore_in (crate::screen_reader_touch).

Narration vocabulary resolves through i18n! bundles; with none loaded it falls back to English so headless builds narrate unchanged.

Structs§

ReadingItem
One stop of the reading cursor: an accessible node, and the id the retained tree (crate::a11y_tree::SemanticTree) gives it, when the order was read from that tree. The id keeps the cursor on its item while the order around it changes.
ScreenReader

Functions§

describe
Compose the spoken phrase for an accessible node — the pure, heavily unit-tested core of the screen reader.
describe_state
Value + state, without name or role — confirms the result of activating or adjusting a control (e.g. “checked”) without re-reading the whole label. The item the keyboard is on inside it (its active_descendant, such as an open combo box’s highlighted option) is read first, so moving through a list reads each item while focus stays put.
flatten_reading_order
The accessibility walk ([crate::a11y_tree::walk]) the AccessKit bridge and the retained tree take, flattened. A widget’s synthetic children (a table’s rows, a keyboard’s keys) follow its widget children, each placed where the widget draws it ([crate::a11y::with_synthetic_bounds]) and followed by the widgets it hosts.
is_form_field
Deliberately covers the editable + actionable controls (buttons, toggles, inputs, ranges, selectors) but not structural containers or static content.
is_heading