Upstream: crates/rune/README.md § Accessibility at
65f8eb43f710, MIT © Anomaly. Bundled by build-rune-apps; links point at this snapshot or at GitHub at that rev.
Accessibility
Every window and overlay exposes its elements to the OS accessibility API through
AccessKit: UI Automation on Windows (Narrator, NVDA, JAWS, Voice
Access), NSAccessibility on macOS (VoiceOver, Voice Control), AT-SPI on Linux (Orca). The same
tree is what automation and testing tools drive. It comes with the default accessibility
feature (crate::a11y, runtime/a11y).
- Free until asked: nothing is built until an assistive client asks for a surface's tree. Then each turn that changed something the tree shows (a commit, a scroll, focus, the end of an animation) rebuilds it from the last frame and sends the nodes that changed. A turn that changed none of it costs one comparison.
- Defaults from what an element already is: its role (
El::role, ARIA's names), its label (El::label, else its text; a button, list row, tab or tree row takes the text inside it), its key as the automation id (UIAAutomationId,AXIdentifier), focus,El::level,El::expanded, a selected item (El::focus_selected), a slider's steps, a text field's value, caret, selection and each line's characters, inline links, scroll viewports with their offsets, modal dialogs (the background leaves the tree), and secure text (never exposed). Plain layout boxes with no key, label or role join their parent, so the tree reads like the interface, not the layout. - Builders for the rest:
description,a11y_value,range_valueandrange_step,checkedandchecked_mixed,disabled,read_only,invalid,sorted,a11y_hidden,live_region(LiveRegion::Polite),position_in_set,shortcut_hintandactive_descendant(the highlighted row of a tree, table or suggestion list whose container or field keeps focus). An icon-only button needs.label("Close"). AnEl::helptooltip describes its element unless it repeats the name;description("")turns that off. - Actions run the handlers a pointer or keyboard user reaches: click presses
(
on_press), focus focuses, increment and decrement step (on_step), set value and text selection edit through the field's editor (soon_input_changeruns), set value on a slider with arange_stepsteps it that many times toward the number, expand and collapse press a disclosure, show context menu callson_secondary_press, and scroll requests move the viewport. They skip hit testing, so a test that wants the pointer's path posts pointer input instead. - Virtual lists expose their mounted rows only; the list reports how many rows it has and each row its index.
- Tools:
--treewrites the tree under"accessibility"(role, key, name, value, states, actions, bounds in window points),Runtime::accessibility_jsonreturns it to tests, andRuntime::accessibility_treereturns AccessKit's wholeTreeUpdate, andRuntime::accessibility_action(key, action, data)runs an assistive action in a test.RUNE_A11Y_LOG=1logs when a client activates a surface's tree, each action, and each update's size and cost.