pub struct AccessNode {Show 30 fields
pub key: Key,
pub parent: Option<Key>,
pub origin: OriginId,
pub role: Role,
pub name: Option<String>,
pub description: Option<String>,
pub rect: Rect,
pub value: Option<String>,
pub caret: Option<usize>,
pub selection: Option<(usize, usize)>,
pub runs: Vec<AccessRun>,
pub anchor: Option<TextPos>,
pub focus: Option<TextPos>,
pub checked: Option<bool>,
pub mixed: bool,
pub selected: Option<bool>,
pub expanded: Option<bool>,
pub pos_in_set: Option<usize>,
pub orientation: Option<Orientation>,
pub set_size: Option<usize>,
pub number: Option<f32>,
pub min: Option<f32>,
pub max: Option<f32>,
pub step: Option<f32>,
pub focused: bool,
pub disabled: bool,
pub modal: bool,
pub scroll: Option<ScrollState>,
pub actions: u32,
pub live: Live,
}Expand description
One semantic node of a frame.
Fields§
§key: Key§parent: Option<Key>The nearest semantic ancestor; None for the root.
origin: OriginId§role: Role§name: Option<String>The accessible name: label, else the node’s own text, else (for
presentational roles) the text inside it, else the window title
for the root.
description: Option<String>description on the spec — the description prop, or a tooltip.
rect: RectFinal laid-out rect, logical px, viewport coordinates, cut to the clip the node is drawn under — the one its hit region carries — so a reader’s hover finds only what a pointer could. A node wholly clipped away is a zero-size rect on the clip’s edge nearest it: still in the tree, still actionable, never hit.
value: Option<String>The node’s string value, which the platform has exactly one slot
for: an editor’s committed text (a custom editor’s: the lines it
draws, joined by "\n"), or a slider’s declared value_text.
A slider that names its reading has only that reading — the
string wins over the number wherever both could be said, which is
what aria-valuetext means and what accesskit_macos does with
AXValue. min / max are unaffected,
and so are the increment actions.
caret: Option<usize>An editor’s caret, a byte offset into value.
selection: Option<(usize, usize)>An editor’s non-empty selection as byte offsets into value.
runs: Vec<AccessRun>An editor’s laid-out text, run by run (see AccessRun).
anchor: Option<TextPos>The caret (focus) and the other end of the selection (anchor,
equal to focus without one) as run positions.
focus: Option<TextPos>§checked: Option<bool>checked for checkbox / radio / switch roles.
mixed: boolA checkbox that is neither on nor off:
reported as mixed whatever checked says.
selected: Option<bool>The current one of a set: every tab carries it, a listItem or a
link only where the view set it (an ordinary list is not a
selection, and “not selected” on every row of one is noise).
None = the node has no such state.
expanded: Option<bool>A disclosure’s state, exactly as declared. None = it does not expand, and a reader says nothing about it.
pos_in_set: Option<usize>“3 of 7”: this node’s zero-based ordinal among the items of the
list / tabList holding it, with set_size on that container.
Derived, never declared — the core counts the semantic children it
already has (see set_size).
orientation: Option<Orientation>How a composite container arranges its items, from its dir (see
Orientation). None = the node is not one of the four composite
containers, and says nothing about arrangement.
set_size: Option<usize>On a list / tabList: how many items it holds. AccessKit puts
the count on the container and the ordinal on the item, unlike
ARIA’s aria-setsize on every item; this follows AccessKit.
number: Option<f32>valueNow / valueMin / valueMax for a slider. What the
position reads as is valueText, which lands in value above
because the platform has one string slot for both.
min: Option<f32>§max: Option<f32>§step: Option<f32>A slider’s valueStep, where it declared one.
focused: boolHolds keyboard focus (Core::focus).
disabled: boolDeclared disabled: inert, and not in the Tab ring.
modal: boolThe frame’s modal surface (aria-modal): the Tab ring and every
pointer are confined to it, and everything else is inert. Only the
modal in effect carries it — the last one declared — so a confirm
inside a dialog leaves the dialog an ordinary node.
scroll: Option<ScrollState>§actions: u32Bitset of AccessAction::bit.
live: LiveDeclared live: when the text inside this node changes, a reader
reads the change without being asked. Carried exactly where the
view declared it — the platform consumer inherits it down the
subtree, and duplicating that here would be a second copy of a
rule kui does not own.
Implementations§
Source§impl AccessNode
impl AccessNode
Sourcepub fn to_value(&self, h: Handles) -> Value
pub fn to_value(&self, h: Handles) -> Value
The node as plain data, every field under its snake_case name and
every key spelled by h. The slider’s numbers are value_now,
value_min, value_max — the rows that set them, not the
fields that hold them; actions is the list of
action names, live and role and orientation their schema
names.
pub fn supports(&self, action: AccessAction) -> bool
Sourcepub fn action_list(&self) -> Vec<AccessAction>
pub fn action_list(&self) -> Vec<AccessAction>
The actions this node advertises.
Sourcepub fn line_offset(&self, pos: TextPos) -> Option<(usize, usize)>
pub fn line_offset(&self, pos: TextPos) -> Option<(usize, usize)>
Turns a run position back into the line it is on and a byte offset
into that line’s text (the "\n" counting as the line’s end).
Sourcepub fn text_pos(&self, line: usize, offset: usize) -> Option<TextPos>
pub fn text_pos(&self, line: usize, offset: usize) -> Option<TextPos>
The run position of a byte offset into line line’s text: the
run holding it, or the line’s last run for its end. An offset inside
a character is the character’s start: a custom editor’s caret is
the app’s number, and slicing there panicked, which emptied the
whole tree for every frame it stood.