pub struct SemanticsNode {Show 45 fields
pub node_id: NodeId,
pub role: SemanticsRole,
pub widget_role: Option<SemanticsWidgetRole>,
pub actions: Vec<SemanticsAction>,
pub children: Vec<SemanticsNode>,
pub description: Option<String>,
pub state_description: Option<String>,
pub on_click_label: Option<String>,
pub on_long_click: Option<SemanticsLongClick>,
pub on_long_click_label: Option<String>,
pub on_magic_tap: Option<SemanticsMagicTap>,
pub on_magic_tap_label: Option<String>,
pub input_labels: Vec<String>,
pub language: Option<String>,
pub selected: Option<bool>,
pub toggled: Option<bool>,
pub enabled: bool,
pub custom_actions: Vec<SemanticsCustomAction>,
pub canvas_children: Vec<CanvasSemanticsNode>,
pub editable_text: bool,
pub hidden: bool,
pub is_modal: bool,
pub merge_descendants: bool,
pub selectable_group: bool,
pub pane_title: Option<String>,
pub error: Option<String>,
pub password: bool,
pub traversal_index: f32,
pub text: Option<String>,
pub text_selection: Option<TextRange>,
pub focusable: bool,
pub focused: bool,
pub live_region: Option<LiveRegionMode>,
pub progress: Option<ProgressBarRangeInfo>,
pub set_progress: Option<SemanticsSetProgress>,
pub set_text: Option<SemanticsSetText>,
pub set_selection: Option<SemanticsSetSelection>,
pub expand: Option<SemanticsExpand>,
pub collapse: Option<SemanticsExpand>,
pub dismiss: Option<SemanticsDismiss>,
pub vertical_scroll: Option<ScrollAxisRange>,
pub horizontal_scroll: Option<ScrollAxisRange>,
pub scroll_by: Option<SemanticsScrollBy>,
pub scroll_to_index: Option<SemanticsScrollToIndex>,
pub collection: Option<CollectionInfo>,
}Expand description
A single node within the semantics tree.
Not Eq: a node now carries drawn-control bounds, which are floats. The
tree is compared for “did anything a screen reader can see change”, and
that comparison is PartialEq everywhere else on the accessibility path
(AccessibilityRect, AccessibilityElement) for the same reason.
Fields§
§node_id: NodeId§role: SemanticsRoleWhere this node sits in the tree (layout, text, subcomposition …).
widget_role: Option<SemanticsWidgetRole>What kind of control this node is, as a screen reader announces it —
Compose’s Role. Separate from SemanticsNode::role because a
clickable Row is structurally a layout node and semantically a button.
actions: Vec<SemanticsAction>§children: Vec<SemanticsNode>§description: Option<String>§state_description: Option<String>§on_click_label: Option<String>§on_long_click: Option<SemanticsLongClick>What this control does when a screen reader asks for its long press.
on_long_click_label: Option<String>What the long press does, as a verb phrase a reader reads out.
on_magic_tap: Option<SemanticsMagicTap>What this control does on VoiceOver’s magic tap.
on_magic_tap_label: Option<String>What the magic tap does, as a verb phrase a reader reads out.
input_labels: Vec<String>The short names a person says to Voice Control to reach this control.
language: Option<String>The language of this control’s text, as a BCP 47 tag.
selected: Option<bool>§toggled: Option<bool>§enabled: bool§custom_actions: Vec<SemanticsCustomAction>§canvas_children: Vec<CanvasSemanticsNode>Controls this node drew rather than laid out; their bounds are relative
to this node’s own top-left. See CanvasSemanticsNode.
editable_text: boolWhether a screen reader skips this node and everything under it.
is_modal: boolWhether this subtree makes content outside it unavailable to assistive technology.
merge_descendants: boolWhether a screen reader takes this node and the text under it as one stop.
selectable_group: boolWhether the selectable controls under this node form one group.
pane_title: Option<String>The title of the screen or pane this node is the root of.
error: Option<String>Why the control’s content is wrong, when it is.
password: boolWhether this field holds a secret, so its text stays unspoken.
traversal_index: f32Where a screen reader visits this node among the ones beside it.
text: Option<String>The text an editable field holds.
text_selection: Option<TextRange>§focusable: boolWhether this node registered a focus target, so focus can land on it.
Compose’s SemanticsProperties.Focused companion.
focused: boolWhether focus sits on this node right now.
live_region: Option<LiveRegionMode>How urgently a screen reader reads this node when its text changes.
Compose’s SemanticsProperties.LiveRegion.
progress: Option<ProgressBarRangeInfo>The value this control holds inside a range. Compose’s
ProgressBarRangeInfo.
set_progress: Option<SemanticsSetProgress>What this control does when a screen reader moves its value.
set_text: Option<SemanticsSetText>What this field does when a screen reader hands it text.
set_selection: Option<SemanticsSetSelection>What this field does when a screen reader moves its caret or picks a stretch of its text.
expand: Option<SemanticsExpand>What this control does when a screen reader asks it to open.
collapse: Option<SemanticsExpand>What this control does when a screen reader asks it to close.
dismiss: Option<SemanticsDismiss>What this control does when a screen reader asks to send it away.
vertical_scroll: Option<ScrollAxisRange>How far this container scrolled up and down, when it scrolls.
horizontal_scroll: Option<ScrollAxisRange>How far this container scrolled left and right, when it scrolls.
scroll_by: Option<SemanticsScrollBy>What this container does when a screen reader pages it.
scroll_to_index: Option<SemanticsScrollToIndex>What this list does when a screen reader asks for the row at an index.
collection: Option<CollectionInfo>How many rows and columns this list holds, when it is a list.
Implementations§
Source§impl SemanticsNode
impl SemanticsNode
Sourcepub fn merges_accessibility_descendants(&self) -> bool
pub fn merges_accessibility_descendants(&self) -> bool
Whether this node combines its static descendants into one reader stop. Independently operable descendants remain separate stops.
Sourcepub fn is_accessibility_boundary(&self) -> bool
pub fn is_accessibility_boundary(&self) -> bool
Whether an ancestor must leave this node and its content as a separate reader stop or container instead of including it in its own label.
Sourcepub fn accessibility_children(&self) -> Vec<&Self>
pub fn accessibility_children(&self) -> Vec<&Self>
Children in screen-reader order. Equal indices retain composition order; non-finite indices are treated as the default index, zero.
Sourcepub fn accessibility_label(&self) -> Option<Cow<'_, str>>
pub fn accessibility_label(&self) -> Option<Cow<'_, str>>
The accessible name, including merged static descendants in reading order. Hidden content and independent controls contribute no text to an ancestor. Password values never become names. An unnamed editable field returns an empty name so it remains reachable by assistive technology.