a11yrole

package
v0.89.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package a11yrole holds the one decision the three native accessibility bridges (cocoa, win32, atspi) must agree on: which nodes of the toolkit's accessibility tree are published when they carry no accessible name.

It is pure Go with no OS dependency, so the rule is unit-tested at 100% on the Linux lane whatever platform a bridge targets.

The rule. A nameless node is dropped only when its role cannot take focus or input. A static, nameless element says nothing a reader could announce and is an unlabelled stop for nothing. A nameless FIELD is different: the user can still focus it and type into it, and each platform announces such a control from its role plus its value. Sources read when this was written:

  • macOS: AppKit's NSAccessibilityProtocols.h (macOS SDK) declares accessibilityLabel as nullable and carries a control's content in accessibilityValue (NSAccessibilityStaticText, Slider, Stepper). The cocoa bridge therefore sets the label only when there is a name, and always sets the value.
  • Windows: "UI Automation Support for the Edit Control Type" (MicrosoftDocs/win32, uiauto-supporteditcontroltype.md) says the Name of an edit control comes from its static label, and "should never contain the textual contents of the edit control"; the contents are the Value pattern's Value. The win32 bridge keeps Name empty and answers the Value property.
  • Linux: at-spi2-core's Accessible.xml says an interactive object with no Name or labelled-by relation means "something is missing from your application". The atspi bridge publishes no Text interface yet, so Label falls back to the value rather than leave Orca with a bare role.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interactive

func Interactive(r toolkit.Role) bool

Interactive reports whether a node of this role can take focus or input, so that it must stay in the published tree even without a name. It follows the WAI-ARIA roles the toolkit's roles are named after: widgets and composite widgets are focusable; structure, landmarks and static content are not.

func Label

func Label(n toolkit.A11yNode) string

Label is the accessible name a bridge that has no separate value channel publishes: the node's Name, or, for an interactive node with none, its Value, so the field's content is still announced. A static node never borrows its value as a name.

func Nodes

func Nodes(root toolkit.Widget) []toolkit.A11yNode

Nodes returns the nodes of root that Skip keeps, in visual order.

func Skip

func Skip(n toolkit.A11yNode) bool

Skip reports whether a node is left out of the published tree: it has no area to point at, or it has no name and cannot take focus or input.

Types

This section is empty.

Jump to

Keyboard shortcuts

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