accessibility

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: BSD-3-Clause Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package accessibility builds the platform-neutral semantic tree that screen-reader backends expose to assistive technologies (#484).

The semantic layer itself — [core.Accessible], the role vocabulary, state flags and actions — lives in the public core package and is always compiled. This package adds the geometry: it walks a canvas's rendered object trees (content, canvas-drawn menu, overlays) and produces [Node] values carrying absolute bounds, label, role and the optional value/state/action properties, nested under their closest accessible ancestor. Platform backends (NSAccessibility, UIA, ...) translate these nodes into their native element trees; none of the code here talks to a platform API, which is the seam that keeps backends swappable.

The walker is only compiled under the `accessibility` build tag, mirroring upstream Bellui's opt-in mechanism; without the tag this package contributes only the Enabled constant (false) so untagged builds carry no extra code.

The walker descends both containers and widget renderers, so accessible widgets inside scroll areas or composite widgets are found. Descendants of a node whose role reports ChildrenPresentational (WAI-ARIA's "children presentational": buttons, tabs, sliders, ...) are dropped — those widgets are one semantic unit and their internal accessible widgets only paint them. Text-bearing roles (labels, text inputs, select) use the selective variant instead (NonInteractiveChildrenPresentational, #522): the internal widgets painting their value are dropped, but embedded interactive controls — an Entry's ActionItem button, hyperlinks inside rich text — stay in the tree, hoisted past any dropped textual wrapper.

Ordering

Nodes are emitted in tree order — the order children appear in their container, parents before children, content roots before menu before overlays. This is the logical reading order of the UI and is what assistive technologies use for sequential navigation. Under a right-to-left layout direction (global, per-canvas, or a container.DirectionScope subtree) the emitted order does not change: mirroring only moves objects, so bounds reflect the mirrored positions (read live from the laid-out tree) while the node order remains the reading order. Backends that want visual-order navigation can sort by the reported bounds.

Index

Constants

View Source
const Enabled = false

Enabled reports whether the toolkit was built with accessibility support (the `accessibility` build tag). Driver code can branch on it instead of duplicating build constraints; untagged builds see false and the dead branches are eliminated at compile time.

Variables

This section is empty.

Functions

func AddAnnouncementListener

func AddAnnouncementListener(fn func(text string, assertive bool)) (remove func())

AddAnnouncementListener is a no-op without the accessibility build tag; see the tagged implementation for the contract.

func Announce

func Announce(text string, assertive bool)

Announce is a no-op without the accessibility build tag; see the tagged implementation for the contract.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL