---
title: "Accessibility (Linux AT-SPI, macOS NSAccessibility)"
url: https://recursiveai.org/oneapp/docs/accessibility/
description: "A running app offers its windows to screen readers (Orca) and other assistive technology on the desktop's accessibility bus. What it offers is the…"
version: "1.0.0"
source: https://github.com/recursive-ai-oss/oneapp-csharp/blob/64b0f3162f8c1b7bb766ceae32357442feaa5960/docs/accessibility.md
---

# Accessibility (Linux AT-SPI, macOS NSAccessibility)

A running app offers its windows to screen readers (Orca) and other assistive technology on the desktop's accessibility bus. What it offers is the accessibility tree OneHtml computes for each page (roles, names, descriptions and states from WAI-ARIA, HTML-AAM and the accessible-name algorithm), exported as AT-SPI2 objects. On macOS the same tree is given to the system's NSAccessibility and on Windows to UI Automation (see the end of this page).

## Switching it

```csharp
new AppOptions(html) { Accessibility = AccessibilityMode.Auto }   // the default
```

| Mode | What the app does |
|---|---|
| `Auto` | Looks for the accessibility bus at start. Registers when the desktop says assistive technology is wanted (`org.a11y.Status` `IsEnabled` or `ScreenReaderEnabled` is true), and registers later when that turns true. Until then it holds one idle session-bus socket and does no work. |
| `On` | Registers whenever an accessibility bus exists. |
| `Off` | Never connects. |

`AppHost.AccessibilityStatus` says where the bridge is: `Off`, `Waiting` (`Auto`, not asked yet), `Active`, or `Unavailable` with an `AccessibilityReason` and a sentence naming the cause: `NoSessionBus`, `NoAccessibilityBus` (the session bus has no `org.a11y.Bus`), `ConnectionFailed` (the bus or the registry refused), `ConnectionLost`, `UnsupportedPlatform`. `AccessibilityStatusChanged` fires on the UI thread when it changes. A bridge that cannot run never affects the app. The harness `status` verb reports the same under `accessibility`.

## What is exported

- **Application** (`/org/a11y/atspi/accessible/root`, role application, interface `Application`), registered through `org.a11y.atspi.Socket.Embed`; its children are the open windows.
- **Windows**: a frame (a dialog for a window with a parent, a popup menu for a menu), with state `active` while it has focus. Its child is the page's document (`document web`), then the page's tree. Ignored nodes (hidden, presentational, uninteresting generics) are left out and their children take their place.
- **Elements and text**, with the WAI-ARIA role mapped to the AT-SPI role (button, heading, link, entry, check box, slider, list, table, landmark, and so on; generic containers are `section`, text is `static`). Text that a parent already carries as its name (a button's label) is not repeated as a child.
- Interfaces: see the table below.
- States: enabled, sensitive, showing, visible, focusable, focused, checked/checkable/indeterminate, pressed, expanded/collapsed, selected, required, invalid entry, read-only, editable, single/multi line, modal, busy, has popup, horizontal/vertical, active (windows).
- Extents come from the page's layout in device pixels, in window coordinates (screen coordinates add the window position the platform reports, which a Wayland compositor does not give; parent coordinates are relative to the parent).

## Interfaces

| Interface | Where | What it answers |
|---|---|---|
| `Accessible` | everything | name, description, role, states, children, parent, index, attributes, `GetRelationSet` |
| `Application`, `Cache` | the application object | toolkit name, version, id; the whole tree in one `GetItems` |
| `Component` | everything | extents, position, size, hit test (`GetAccessibleAtPoint`), `GrabFocus`; moving or resizing is refused |
| `Action` | buttons, links, checkboxes, radios, switches, tabs, menu items, options, tree items, combo boxes that are not disabled | one action: `click` (`jump` for links) |
| `Text` | text fields, static text, and any container that holds links | text, caret, selection, word and line granularities, extents, **attribute runs** |
| `EditableText` | text fields that are not read-only | set, insert and delete text |
| `Value` | sliders, spin buttons, progress bars, meters, scroll bars | current, minimum and maximum (read-only) |
| `Selection` | `listbox`, `tablist`, `tree`, `grid`, `treegrid`, `menu`, `menubar` that have selectable children | selected count and children, `IsChildSelected`, `SelectChild`; `DeselectChild`, `SelectAll` and `ClearSelection` on multi-selectable containers |
| `Table` | `table`, `grid`, `treegrid` | rows, columns, caption, cell at row and column (spans included), indexes, extents, row and column headers and descriptions, selected rows |
| `TableCell` | `cell`, `gridcell`, `columnheader`, `rowheader` in a table | row and column, spans, the table, header cells |
| `Hypertext` | a container with links in its text | link count, the link at an index, the link at a text offset |
| `Hyperlink` | links | URI, start and end index in the container's text, the link object, `IsValid` |
| `Image` | images | description (the alt text), extents, position, size |

**Relations** (`GetRelationSet`), from the WAI-ARIA references and native labels, with the reverse relation on the target: `labelled-by`/`label-for` (`aria-labelledby`, `<label>`), `described-by`/`description-for` (`aria-describedby`), `controller-for`/`controlled-by` (`aria-controls`), `details`/`details-for` (`aria-details`), `error-message`/`error-for` (`aria-errormessage`), `flows-to`/`flows-from` (`aria-flowto`). A target the tree leaves out is stood for by the nearest object that holds it. `aria-owns` is not a relation: it changes the tree.

**Selection.** The selectable children of a container are its descendants of the item role (`option` for a listbox, `tab` for a tablist, `treeitem` for a tree, `row` for a grid, `menuitem*` for a menu), in tree order. An item is selected when it has `aria-selected="true"`; in a menu it is the item that has focus. Selecting is a press on the item (focus for a menu item), so the page's own handler decides what selection means. `StateChanged:selected` and `SelectionChanged` are sent when it changes.

**Tables.** Cells are placed on a grid by `colspan`/`rowspan` (or `aria-colspan`/`aria-rowspan`, clamped to 1000; a table over a million cells gets no `Table` interface). Indexes count grid slots, so a cell that spans two columns answers for both.

**Text attributes.** Each text object has runs of uniform style, and every run carries its full set of attributes, from the computed style: `family-name`, `size` (points), `weight`, `style`, `underline`, `strikethrough`, `fg-color` and `bg-color` (`r,g,b`, 0–65535 each), `justification`, `direction`. A container with links has one run per piece, the link's colour and underline included. A link is one `U+FFFC` in its container's text.

**Live regions.** `aria-live` (and the implied values of `alert`, `status` and `log`), `aria-atomic`, `aria-relevant` and `aria-busy` are exposed as the object attributes `live`, `atomic`, `relevant` on the region and `container-live`, `container-atomic`, `container-relevant`, `container-busy` on everything inside it. When a region's content changes the bridge sends AT-SPI's `Announcement` event on it (details: text; detail1: 1 polite, 2 assertive): the whole content for an atomic region, otherwise the added text. A region that appears with content is announced only when it is an alert; a busy region, an `aria-live="off"` one and removals are not announced. The kit's toaster is such a region, so a toast is spoken when it appears.

## Events

Compared after each change the page shows (and after window, focus and input events), so a state change anywhere is found even when the app changed it from its own code:

`StateChanged` (focused, active, checked, sensitive, expanded, showing, …), the legacy `Focus:Focus`, `Window:Create`/`Destroy`/`Activate`/`Deactivate`, `ChildrenChanged` (add and remove, with the child's reference), `PropertyChange` (`accessible-name`, `accessible-description`, `accessible-role`, `accessible-value`), `TextChanged` (insert and delete, with the text), `SelectionChanged` (of a selection container), `Announcement` (live regions), `TextCaretMoved` and `TextSelectionChanged` for the focused text field. An idle app sends nothing and does no work.

The tree is rebuilt in full when something changed and the two pictures are compared, so only the differences are announced; the cost is one accessibility-tree build per visible change, and only while the bridge is active. OneHtml's incremental tree update works from an edit of an immutable document, and the live page the app draws exposes no feed of its edits, so the bridge cannot use it yet.

## Doing things

Assistive technology acts through the page's own input, never around it:

- `Action.DoAction` moves the pointer onto the element's centre and presses and releases the primary button, so hover and active states, `pointerdown`/`click` listeners and default actions run. An element that is off screen or covered gets the DOM's `click()` instead.
- `Component.GrabFocus` is the DOM's `focus()`.
- `EditableText` focuses the field, selects all and types the new text (Backspace for an empty one); `InsertText` and `DeleteText` compute the new text the same way and put the caret back. Cut, copy and paste are refused: the clipboard belongs to the person.
- `SetCaretOffset` and the selection calls set the field's selection.
- `Value` is read-only; moving a slider is keyboard and pointer input.

Messages from the bus are checked against the interface signatures; a malformed call gets `InvalidArgs`, a call to an object that has gone gets `UnknownObject`.

## Trying it

`samples/Native` has a view built for this (`Native access`): tabs, a menu, a table, a link, a labelled field, an image and a toast. Start a private session bus with `at-spi-bus-launcher` and `at-spi2-registryd`, set `org.a11y.Status.IsEnabled` to true, run an app, and walk it with any AT-SPI client (Orca, `Atspi` from Python's `gi`, Accerciser). The tests in `tests/OneApp.Tests/AccessibilityBridgeTests.cs` use a fake registry and a hand-written client on private `dbus-daemon`s.

## Limits

- Not exported: `Collection`, `Document`, `Selection` on the document, `Text` bounds-changed events, `aria-owns` as relations, column selection in tables, and `Value` writes. Text attributes are per run, not per style change inside a text field.
- A live region is compared by what it says, so changing its text to the same words is not announced.
- Child lists of windows with a very large number of elements are rebuilt in full for each change.

## macOS (NSAccessibility)

On macOS each window hands OnePlatform's `WindowAccessibility` a provider (`IAccessibilityProvider`) made from the same picture of the pages the AT-SPI bridge uses, so roles, names, descriptions, states, text, ranges and bounds agree on both desktops (`AccessibilityMap` turns the ARIA role into an `AccessibleRole` and the states into `AccessibleStates`; OnePlatform maps those to AX roles, subroles and attributes, see its `docs/accessibility.md`). Bounds are in window pixels, as pointer positions are.

| `AppOptions.Accessibility` | Effect |
|---|---|
| `Auto` (default) | The providers are attached, but nothing is built until a client (VoiceOver, Accessibility Inspector, any `AXUIElement` client) asks. `AppHost.AccessibilityStatus` is `Waiting` / `NotRequested` until then and `Active` after the first request. |
| `On` | The same, reported `Active` from the start. |
| `Off` | No provider is attached; the status is `Off`. |

On macOS, when a window has no platform bridge (the headless backend), `AccessibilityStatus` is `Unavailable` / `UnsupportedPlatform`.

**Cost.** While no client is connected the app builds and compares nothing: a change only marks the picture stale. Once a client is connected, each turn of the loop in which the page changed builds the picture again (one accessibility-tree build, like the AT-SPI bridge), compares it with the last one and posts what differs, then `WindowAccessibility.Flush()` tells the system once. The system does not tell the app when a client goes away, so once one has asked the app keeps comparing after each page change (an idle app still does nothing). Measured on an Apple-silicon Mac mini with a todo list open: 0.00 s of CPU in 60 s with no client, 0.01 s in 60 s with a client connected and listening, 0.00 s in 60 s after it left.

**Ids.** A node's id comes from the same key the AT-SPI bridge uses (the element's `id`, or its tag and position among its siblings, under the window), handed out once and never reused, so a client's reference to a button stays good while the button exists, across re-renders.

**What changes become.** A different list of children is a structure change of the parent; a changed name a name change; changed text of a field or a changed range a value change; any other state bit (checked, expanded, selected, disabled, …) a states change; a field's selection a selection change; and a different focused element a focus change.

**Doing things** goes through the page's own input exactly as AT-SPI does (`PageActions`, shared by both): press is the pointer path with the DOM `click()` as the fallback for an element that is covered or off screen, focus is the DOM's `focus()`, set value focuses the field, selects all and types, set selection moves the field's selection (a range outside the text is refused), and increment and decrement press ArrowUp and ArrowDown on the focused slider or spin button, so the page's own keys decide what a step means.

**Limits.** The macOS provider does not yet use the relations, tables, selection, live regions or text attributes that the Linux bridge exports from the same tree. Password fields are reported masked. VoiceOver itself was not run for this work, because it speaks aloud; the `AXUIElement` client in `tools/AxProbe` stands in for it.

## Trying it on macOS

`tools/AxProbe` is a small `AXUIElement` client: `AxProbe <pid> tree watch press:Add set:... wait:1 notes`. The program that runs it needs the Accessibility permission. It touches only the pid it is given. The in-process tests (`tests/OneApp.Tests/PlatformAccessibilityTests.cs`) drive the provider directly and run everywhere.

## Windows (UI Automation)

On Windows each window hands OnePlatform's `WindowAccessibility` the same provider macOS uses, so roles, names, descriptions, states, text, ranges and bounds are the same picture on every desktop. The platform layer answers the window's `WM_GETOBJECT` with a UI Automation provider tree built from it: control types follow Core-AAM, and the Invoke, Toggle, Value, RangeValue, ExpandCollapse and SelectionItem patterns are offered where the element has the matching action or state. The modes, cost, ids, change reporting and the way actions go through the page's own input are as in the macOS section above; nothing is built until a client (Narrator, Accessibility Insights, any UI Automation client) asks.

| | Linux (AT-SPI) | macOS (NSAccessibility) | Windows (UI Automation) |
|---|---|---|---|
| Tree, names, roles, states | yes | yes | yes |
| Actions (press, focus, set value) | yes | yes | Invoke, Toggle, Value, RangeValue, ExpandCollapse, SelectionItem; `SetFocus` |
| Focus and structure changes | yes | yes | yes |
| Relations, tables, text attributes, live regions | yes | not yet | not yet |

To try it, run an app and read it from a UI Automation client in the same desktop session: the window is found by its title, its buttons are children with the `Button` control type, `InvokePattern.Invoke()` runs a click handler and `SetFocus()` moves the keyboard focus (`AutomationElement.FocusedElement` follows).
