Skip to content

Accessibility ​

Every widget exposes a semantic snapshot, every control works from the keyboard, and an in-process AT-SPI bridge serves both to screen readers.

Modes ​

The bridge (internal/atspi) runs while the desktop asks for assistive technologies (org.a11y.Status IsEnabled or ScreenReaderEnabled on the session bus) and stops when it stops asking. Otherwise the tree is never walked. No app code is needed.

SettingEffect
Application.SetAccessibility(app.A11yAuto)default: follow the desktop's switch
app.A11yOnalways serve
app.A11yOffnever serve
LYS_UI_A11Y=atspi / noneoverrides the app, like GTK_A11Y

Semantic model ​

widget.Describe(w) returns an A11yState:

  • role (Role, mirroring AT-SPI: button, label, entry, text-area, slider, switch, check-box, progress-bar, scroll-area, list, menu, tab-list, image, ...). An ImageView is an image described by its zoom; an Image is an image while it is named (SetAccessibleName or a tooltip) and decoration, with no role, while it is not;
  • name: SetAccessibleName, else the tooltip, else the label text;
  • text with caret and selection as rune offsets;
  • checked state and min/max/value/step;
  • expansion: ExpansionNone, or for a disclosure trigger ExpansionCollapsed or ExpansionExpanded, set with SetAccessibleExpansion. Expander, an AccordionItem's trigger and an ActionRow with a disclosure (ExpanderRow) set it themselves. The bridge serves it as AT-SPI's expandable state, plus expanded while open;
  • editable, multiline, enabled (including ancestors), focusable;
  • bounds.

Read-only text reports editable false. Disabled widgets report enabled, editable and focusable false. widget.DescribeTree(root) walks in paint order, which is also focus order.

Keyboard ​

Every interactive control is reachable by Tab and activated by Enter or Space. A bar takes the keyboard only when asked: BarWindow.WalkKeyboard(done) focuses its first control, moves with the arrows and Tab, presses with Enter or Space, and releases on Esc.

Announcements ​

widget.Announce(w, text, politeness) speaks text without moving focus. widget.SetLiveRegion(w, politeness) makes every label text change inside w speak. Politeness is widget.Polite or widget.Assertive. A live region that changes several times in one pass speaks once. Announcements from widgets not in a served window are dropped. Toasts are polite live regions.

The bridge ​

  • On the loop, a sampling pass builds a tree of widget.A11yState snapshots keyed by stable widget identity. An emitter goroutine publishes it, diffs it against the previous tree and emits events. D-Bus handlers answer from the published snapshot.
  • A poller checks widget.A11yGeneration every 100 ms and samples only when it moved. Application.ServeAccessibility(app.A11YOptions{Poll: d}, done) sets another interval.
  • Registration: finds the bus with org.a11y.Bus.GetAddress, claims org.a11y.atspi.lysui.p<pid>, exports /org/a11y/atspi/accessible/root, embeds through org.a11y.atspi.Socket.Embed.
  • Interfaces: Accessible, Component (window-relative extents and hit testing), Text (contents, caret, selections, boundaries, character geometry), Action (through the widget's click path), Value (settable for sliders), Application on the root, and org.a11y.atspi.Cache. All support org.freedesktop.DBus.Properties and Introspect.
  • Component.GrabFocus moves focus through the window's router; Text's caret and selection setters work on any widget.TextSelector.
  • Events: focus, state-changed (checked, pressed, expandable, expanded, enabled, sensitive, editable), text-caret-moved, TextChanged, TextSelectionChanged, bounds-changed, children-changed, PropertyChange for name and value, and Object.Announcement. Order is deterministic: focus first, then per node by ascending id.

Limits ​

  • Component coordinates are window-relative; Wayland gives clients no screen position.
  • Text attributes (GetAttributeRun) report none.
  • No Selection or Table interfaces.

Verification ​

CommandChecks
just atspithe bridge against a private bus that plays registry and AT
just atspi-verifyagainst real at-spi2-core: launcher and registryd on a private bus
go run -tags atspi ./cmd/lys-ui-a11ythe a11y demo with the bridge forced on, for Orca or Accerciser

Applications test their own tree with atspitest: Start brings up at-spi2-core on a private bus (skipped without ATSPI_LIBEXEC; ATSPI_GSETTINGS_SCHEMA_DIR supplies the schema), Enable turns on the desktop switch, Application finds the app, and Names walks its tree.

Released under the MIT License.