pub struct Node { /* private fields */ }
Expand description
A single accessible object. A complete UI is represented as a tree of these.
For brevity, and to make more of the documentation usable in bindings to other languages, documentation of getter methods is written as if documenting fields in a struct, and such methods are referred to as properties.
Implementations§
source§impl Node
impl Node
pub fn is_autofill_available(&self) -> bool
pub fn is_default(&self) -> bool
pub fn is_editable(&self) -> bool
pub fn is_hovered(&self) -> bool
Exclude this node and its descendants from the tree presented to assistive technologies, and from hit testing.
pub fn is_linked(&self) -> bool
pub fn is_multiline(&self) -> bool
pub fn is_multiselectable(&self) -> bool
pub fn is_protected(&self) -> bool
pub fn is_required(&self) -> bool
pub fn is_visited(&self) -> bool
pub fn is_busy(&self) -> bool
pub fn is_live_atomic(&self) -> bool
sourcepub fn is_scrollable(&self) -> bool
pub fn is_scrollable(&self) -> bool
Indicates this node is user-scrollable, e.g. overflow: scroll|auto
, as
opposed to only programmatically scrollable, like overflow: hidden
, or
not scrollable at all, e.g. overflow: visible
.
sourcepub fn is_selected_from_focus(&self) -> bool
pub fn is_selected_from_focus(&self) -> bool
Indicates whether this node is selected due to selection follows focus.
sourcepub fn is_touch_pass_through(&self) -> bool
pub fn is_touch_pass_through(&self) -> bool
This element allows touches to be passed through when a screen reader is in touch exploration mode, e.g. a virtual keyboard normally behaves this way.
sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Use for a textbox that allows focus/selection but not input.
sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Use for a control or group of controls that disallows input.
pub fn is_bold(&self) -> bool
pub fn is_italic(&self) -> bool
sourcepub fn canvas_has_fallback(&self) -> bool
pub fn canvas_has_fallback(&self) -> bool
Set on a canvas element if it has fallback content.
sourcepub fn clips_children(&self) -> bool
pub fn clips_children(&self) -> bool
Indicates that this node clips its children, i.e. may have
overflow: hidden
or clip children by default.
sourcepub fn is_line_breaking_object(&self) -> bool
pub fn is_line_breaking_object(&self) -> bool
Indicates whether this node causes a hard line-break
(e.g. block level elements, or <br>
).
sourcepub fn is_page_breaking_object(&self) -> bool
pub fn is_page_breaking_object(&self) -> bool
Indicates whether this node causes a page break.
pub fn is_spelling_error(&self) -> bool
pub fn is_grammar_error(&self) -> bool
pub fn is_search_match(&self) -> bool
pub fn is_suggestion(&self) -> bool
sourcepub fn is_nonatomic_text_field_root(&self) -> bool
pub fn is_nonatomic_text_field_root(&self) -> bool
The object functions as a text field which exposes its descendants.
Use cases include the root of a content-editable region, an ARIA
textbox which isn’t currently editable and which has interactive
descendants, and a <body>
element that has “design-mode” set to “on”.
source§impl Node
impl Node
sourcepub fn indirect_children(&self) -> &[NodeId]
pub fn indirect_children(&self) -> &[NodeId]
Ids of nodes that are children of this node logically, but are not children of this node in the tree structure. As an example, a table cell is a child of a row, and an ‘indirect’ child of a column.
source§impl Node
impl Node
sourcepub fn radio_group(&self) -> &[NodeId]
pub fn radio_group(&self) -> &[NodeId]
On radio buttons this should be set to a list of all of the buttons in the same group as this one, including this radio button itself.
source§impl Node
impl Node
sourcepub fn font_family(&self) -> Option<&str>
pub fn font_family(&self) -> Option<&str>
Only present when different from parent.
source§impl Node
impl Node
sourcepub fn inner_html(&self) -> Option<&str>
pub fn inner_html(&self) -> Option<&str>
Inner HTML of an element. Only used for a top-level math element, to support third-party math accessibility products that parse MathML.
source§impl Node
impl Node
sourcepub fn placeholder(&self) -> Option<&str>
pub fn placeholder(&self) -> Option<&str>
Only if not already exposed in name
(NameFrom::Placeholder
).
source§impl Node
impl Node
sourcepub fn font_weight(&self) -> Option<f64>
pub fn font_weight(&self) -> Option<f64>
Font weight can take on any arbitrary numeric value. Increments of 100 in
range [0, 900]
represent keywords such as light, normal, bold, etc.
source§impl Node
impl Node
sourcepub fn color_value(&self) -> Option<u32>
pub fn color_value(&self) -> Option<u32>
For Role::ColorWell
, specifies the selected color in RGBA.
source§impl Node
impl Node
pub fn strikethrough(&self) -> Option<TextDecoration>
source§impl Node
impl Node
sourcepub fn character_lengths(&self) -> &[u8] ⓘ
pub fn character_lengths(&self) -> &[u8] ⓘ
For inline text. The length (non-inclusive) of each character
in UTF-8 code units (bytes). The sum of these lengths must equal
the length of value
, also in bytes.
A character is defined as the smallest unit of text that can be selected. This isn’t necessarily a single Unicode scalar value (code point). This is why AccessKit can’t compute the lengths of the characters from the text itself; this information must be provided by the text editing implementation.
If this node is the last text box in a line that ends with a hard line break, that line break should be included at the end of this node’s value as either a CRLF or LF; in both cases, the line break should be counted as a single character for the sake of this slice. When the caret is at the end of such a line, the focus of the text selection should be on the line break, not after it.
source§impl Node
impl Node
sourcepub fn word_lengths(&self) -> &[u8] ⓘ
pub fn word_lengths(&self) -> &[u8] ⓘ
For inline text. The length of each word in characters, as defined
in character_lengths
. The sum of these lengths must equal
the length of character_lengths
.
The end of each word is the beginning of the next word; there are no characters that are not considered part of a word. Trailing whitespace is typically considered part of the word that precedes it, while a line’s leading whitespace is considered its own word. Whether punctuation is considered a separate word or part of the preceding word depends on the particular text editing implementation. Some editors may have their own definition of a word; for example, in an IDE, words may correspond to programming language tokens.
Not all assistive technologies require information about word boundaries, and not all platform accessibility APIs even expose this information, but for assistive technologies that do use this information, users will get unpredictable results if the word boundaries exposed by the accessibility tree don’t match the editor’s behavior. This is why AccessKit does not determine word boundaries itself.
source§impl Node
impl Node
sourcepub fn character_positions(&self) -> Option<&[f32]>
pub fn character_positions(&self) -> Option<&[f32]>
For inline text. This is the position of each character within
the node’s bounding box, in the direction given by
text_direction
, in the coordinate space of this node.
When present, the length of this slice should be the same as the length
of character_lengths
, including for lines that end
with a hard line break. The position of such a line break should
be the position where an end-of-paragraph marker would be rendered.
This property is optional. Without it, AccessKit can’t support some use cases, such as screen magnifiers that track the caret position or screen readers that display a highlight cursor. However, most text functionality still works without this information.
source§impl Node
impl Node
sourcepub fn character_widths(&self) -> Option<&[f32]>
pub fn character_widths(&self) -> Option<&[f32]>
For inline text. This is the advance width of each character,
in the direction given by text_direction
, in the coordinate
space of this node.
When present, the length of this slice should be the same as the length
of character_lengths
, including for lines that end
with a hard line break. The width of such a line break should
be non-zero if selecting the line break by itself results in
a visible highlight (as in Microsoft Word), or zero if not
(as in Windows Notepad).
This property is optional. Without it, AccessKit can’t support some use cases, such as screen magnifiers that track the caret position or screen readers that display a highlight cursor. However, most text functionality still works without this information.
source§impl Node
impl Node
sourcepub fn is_expanded(&self) -> Option<bool>
pub fn is_expanded(&self) -> Option<bool>
Whether this node is expanded, collapsed, or neither.
Setting this to false
means the node is collapsed; omitting it means this state
isn’t applicable.
source§impl Node
impl Node
sourcepub fn is_selected(&self) -> Option<bool>
pub fn is_selected(&self) -> Option<bool>
Indicates whether this node is selected or unselected.
The absence of this flag (as opposed to a false
setting)
means that the concept of “selected” doesn’t apply.
When deciding whether to set the flag to false or omit it,
consider whether it would be appropriate for a screen reader
to announce “not selected”. The ambiguity of this flag
in platform accessibility APIs has made extraneous
“not selected” announcements a common annoyance.
source§impl Node
impl Node
sourcepub fn name_from(&self) -> Option<NameFrom>
pub fn name_from(&self) -> Option<NameFrom>
What information was used to compute the object’s name.
sourcepub fn description_from(&self) -> Option<DescriptionFrom>
pub fn description_from(&self) -> Option<DescriptionFrom>
What information was used to compute the object’s description.
pub fn invalid(&self) -> Option<Invalid>
pub fn checked_state(&self) -> Option<CheckedState>
pub fn live(&self) -> Option<Live>
pub fn default_action_verb(&self) -> Option<DefaultActionVerb>
pub fn text_direction(&self) -> Option<TextDirection>
pub fn orientation(&self) -> Option<Orientation>
pub fn sort_direction(&self) -> Option<SortDirection>
pub fn aria_current(&self) -> Option<AriaCurrent>
pub fn has_popup(&self) -> Option<HasPopup>
sourcepub fn list_style(&self) -> Option<ListStyle>
pub fn list_style(&self) -> Option<ListStyle>
The list style type. Only available on list items.
pub fn text_align(&self) -> Option<TextAlign>
pub fn vertical_offset(&self) -> Option<VerticalOffset>
source§impl Node
impl Node
sourcepub fn transform(&self) -> Option<&Affine>
pub fn transform(&self) -> Option<&Affine>
An affine transform to apply to any coordinates within this node
and its descendants, including the bounds
property of this node.
The combined transforms of this node and its ancestors define
the coordinate space of this node. /// This should be None
if
it would be set to the identity transform, which should be the case
for most nodes.
AccessKit expects the final transformed coordinates to be relative to the origin of the tree’s container (e.g. window), in physical pixels, with the y coordinate being top-down.
sourcepub fn bounds(&self) -> Option<Rect>
pub fn bounds(&self) -> Option<Rect>
The bounding box of this node, in the node’s coordinate space.
This property does not affect the coordinate space of either this node
or its descendants; only the transform
property affects that.
This, along with the recommendation that most nodes should have
a transform
of None
, implies that the bounds
property
of most nodes should be in the coordinate space of the nearest ancestor
with a non-None
transform
, or if there is no such ancestor,
the tree’s container (e.g. window).