pub struct SemanticNode {
pub label: Option<String>,
pub role: Role,
pub value: Option<String>,
pub heading_level: Option<u8>,
pub href: Option<String>,
pub children: Vec<SemanticNode>,
}Expand description
A node in the accessibility (semantics) tree.
The semantics tree mirrors the visual element tree but carries only the information assistive technologies need. It is rebuilt alongside the render tree and diffed separately.
Fields§
§label: Option<String>Human-readable label announced by screen readers.
role: RoleThe ARIA role of this node.
value: Option<String>The node’s current value, if any (a TextInput’s typed text, a
Slider/ProgressBar’s numeric value as a string, …) — distinct
from label, which is the node’s accessible NAME, not its content.
heading_level: Option<u8>1..=6 for Role::Heading (<h1>-<h6>); None for every other
role, including a heading whose level genuinely isn’t known (falls
back to <h2> at the HTML-mapping step, not here).
href: Option<String>The link target for Role::Link (<a href="...">); None for
every other role.
children: Vec<SemanticNode>Child semantic nodes.
Implementations§
Source§impl SemanticNode
impl SemanticNode
Sourcepub fn value(self, value: impl Into<String>) -> Self
pub fn value(self, value: impl Into<String>) -> Self
Sets the node’s current value (see the field doc for how this
differs from label).
Sourcepub fn heading_level(self, level: u8) -> Self
pub fn heading_level(self, level: u8) -> Self
Sets the heading level (1..=6) — meaningful only for Role::Heading.
Sourcepub fn href(self, href: impl Into<String>) -> Self
pub fn href(self, href: impl Into<String>) -> Self
Sets the link target — meaningful only for Role::Link.
Sourcepub fn child(self, node: SemanticNode) -> Self
pub fn child(self, node: SemanticNode) -> Self
Appends a child semantic node.
Trait Implementations§
Source§impl Clone for SemanticNode
impl Clone for SemanticNode
Source§fn clone(&self) -> SemanticNode
fn clone(&self) -> SemanticNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more