Skip to content

struct

AccessNode

pub struct AccessNode {
    pub role: Role,
    pub name: Option<String>,
    pub description: Option<String>,
    pub level: Option<u8>,
    pub checked: Option<bool>,
    pub expanded: Option<bool>,
    pub selected: Option<bool>,
    pub pressed: Option<bool>,
    pub value: Option<String>,
    pub current: Option<String>,
    pub modal: bool,
    pub disabled: bool,
    pub focusable: bool,
    pub bounds: Option<Rect>,
    pub actions: Vec<String>,
    pub path: Vec<usize>,
    pub children: Vec<AccessNode>,
}

A node in the accessibility tree.

Fields

role

pub role: Role

What the node is.

name

pub name: Option<String>

Its accessible name.

description

pub description: Option<String>

Its accessible description (aria-describedby, aria-description).

level

pub level: Option<u8>

A heading's level (1–6), or a tree item's.

checked

pub checked: Option<bool>

Checked state (checkboxes, radios, switches); None when it has none.

expanded

pub expanded: Option<bool>

Expanded state (aria-expanded); None when it has none.

selected

pub selected: Option<bool>

Selected state (aria-selected); None when it has none.

pressed

pub pressed: Option<bool>

Pressed state of a toggle button (aria-pressed); None when it has none.

value

pub value: Option<String>

Current value of a range widget (aria-valuetext/aria-valuenow).

current

pub current: Option<String>

aria-current token (page, step, true…).

modal

pub modal: bool

Whether it's a modal dialog (aria-modal).

disabled

pub disabled: bool

Whether it's disabled.

focusable

pub focusable: bool

Whether keyboard focus can reach it.

bounds

pub bounds: Option<Rect>

Screen-space bounds within the parent surface (graphics items only).

actions

pub actions: Vec<String>

Event kinds the node responds to.

path

pub path: Vec<usize>

Path of the corresponding virtual node (for dispatching actions).

children

pub children: Vec<AccessNode>

Its children in the accessibility tree.

Methods

new

pub fn new(role: Role, path: Vec<usize>) -> AccessNode

A node with role at path in the rendered tree, with no name, state or children yet.

find_by_role

pub fn find_by_role(&self, role: Role) -> Vec<&AccessNode>

All descendants (including self) with role, in document order.

find

pub fn find(&self, role: Role, name: &str) -> Option<&AccessNode>

The first node with role and accessible name.

to_text

pub fn to_text(&self) -> String

Human-readable dump, one node per line (like a browser's a11y tree).

Trait implementations