pub type SemanticsSpec = SemanticsConfiguration;Expand description
One value that says what a screen reader reads for a node, built up with
the methods below and handed to Modifier::semantics_spec.
Compose has no such value: it takes a receiver lambda, which Kotlin makes
read well and Rust has no match for. SemanticsSpec::new().content_description("Save")
reads better than |config| config.content_description = Some("Save".into()),
it is one chain element rather than one per property, and two specs can be
compared. The closure form stays as Modifier::semantics for parity.
Aliased Type§
pub struct SemanticsSpec {Show 45 fields
pub content_description: Option<String>,
pub state_description: Option<String>,
pub on_click_label: Option<String>,
pub on_click: Option<SemanticsCustomAction>,
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 role: Option<SemanticsWidgetRole>,
pub selected: Option<bool>,
pub toggled: Option<ToggleableState>,
pub enabled: bool,
pub is_clickable: bool,
pub is_editable_text: bool,
pub multiline: bool,
pub text: Option<String>,
pub text_selection: Option<TextRange>,
pub custom_actions: Vec<SemanticsCustomAction>,
pub canvas_children: Vec<CanvasSemanticsNode>,
pub is_modal: bool,
pub hidden: bool,
pub merge_descendants: bool,
pub selectable_group: bool,
pub pane_title: Option<String>,
pub error: Option<String>,
pub hint_text: Option<String>,
pub password: bool,
pub traversal_index: f32,
pub test_tag: Option<String>,
pub test_tags_as_resource_id: Option<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 dismiss: Option<SemanticsDismiss>,
pub collapse: Option<SemanticsExpand>,
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>,
}Fields§
§content_description: Option<String>What a screen reader reads as the name of the node. Compose’s contentDescription.
state_description: Option<String>Compose’s stateDescription.
on_click_label: Option<String>Compose’s onClick(label = …); implies clickable.
on_click: Option<SemanticsCustomAction>Activation callback for controls whose pointer gesture is handled separately. Invoked by keyboard and native accessibility activation after validation.
on_long_click: Option<SemanticsLongClick>What this control does when a screen reader asks for its long press.
Compose’s onLongClick.
on_long_click_label: Option<String>What the long press does, as a verb phrase a reader reads out:
“Remove receipt”. Compose’s onLongClick(label = …).
on_magic_tap: Option<SemanticsMagicTap>What this control does on VoiceOver’s magic tap, and on the other
platforms as an action listed by Self::on_magic_tap_label.
SwiftUI’s accessibilityAction(.magicTap).
on_magic_tap_label: Option<String>What the magic tap does, as a verb phrase a reader reads out: “Take the photo”.
input_labels: Vec<String>The short names a person says to Voice Control to reach this control,
when the name a reader hears is too long to say. SwiftUI’s
accessibilityInputLabels; iOS only.
language: Option<String>The language of this control’s text as a BCP 47 tag, “de” or “pt-BR”,
so a reader picks the right voice for it. SwiftUI’s
accessibilityLanguage, ARIA’s lang.
role: Option<SemanticsWidgetRole>Compose’s Role.
selected: Option<bool>Whether the control is selected. None means the control has no selected state.
toggled: Option<ToggleableState>Whether the control is on, off or partly on. Compose’s
toggleableState.
enabled: boolWhether the control accepts input. A disabled control is announced as such.
is_clickable: boolWhether the control reacts to a click.
is_editable_text: boolWhether the node is a text field a user edits.
multiline: boolWhether an editable field accepts line breaks, independent of its current text.
text: Option<String>The text an editable field holds, read as its value. Compose’s
editableText.
text_selection: Option<TextRange>The selection or the caret of an editable field, as byte offsets into its text.
custom_actions: Vec<SemanticsCustomAction>Named actions that a screen reader lists in its actions menu for the node.
canvas_children: Vec<CanvasSemanticsNode>Controls this node drew itself instead of laying out. See
CanvasSemanticsNode.
is_modal: boolWhether this node takes over the screen: everything outside it is inert, and a screen reader keeps its traversal inside.
Whether a screen reader skips this node and everything under it: a
decorative image, or a placeholder drawn under a named field. Compose’s
hideFromAccessibility.
merge_descendants: boolWhether a screen reader takes this node and the text under it as one
stop, the way it does for a button: a row whose name, count and price
belong together. Compose’s mergeDescendants.
selectable_group: boolWhether the selectable controls under this node form one group, so a
screen reader says which of how many a tab or a radio button is.
Compose’s selectableGroup.
pane_title: Option<String>The title of the screen or pane this node is the root of, read out when
the app moves to it. Compose’s paneTitle.
error: Option<String>Why the control’s content is wrong, read after its state: “invalid,
the amount needs a number”. Compose’s error.
hint_text: Option<String>What using the control does or what it wants, read after its other
words: “double tap to choose a color”. Compose’s hintText.
password: boolWhether this field holds a secret, so screen readers never receive its
text and native editors use protected input. Compose’s password.
traversal_index: f32Where a screen reader visits this node among the ones beside it: a
smaller number comes first, and nodes left at zero keep the order the
app laid them out in. Compose’s traversalIndex.
test_tag: Option<String>A name tests find this node by. Screen readers never read it. UI test
tools find it in the platform’s accessibility tree: the accessibility
identifier on iOS and macOS, the UI Automation AutomationId on
Windows, the AT-SPI accessible id on Linux, the id of the web
mirror’s node, and on Android the view id resource name where
Self::test_tags_as_resource_id holds. Only a node a screen reader
reaches carries it there. Compose’s testTag.
Whether Android publishes the test tags of this node and of the nodes
under it as their view id resource names, where UI Automator’s
By.res finds them. None takes the value of the nearest node above
that sets one, and a tree that sets none keeps the tags off. Compose’s
testTagsAsResourceId.
live_region: Option<LiveRegionMode>Compose’s liveRegion. When set, a screen reader reads this node again
whenever its text changes, without the user moving to it.
progress: Option<ProgressBarRangeInfo>Compose’s progressBarRangeInfo. A control with it is adjustable: a
screen reader offers its own way to move the value.
set_progress: Option<SemanticsSetProgress>What the control does when a screen reader moves its value. Compose’s
setProgress.
set_text: Option<SemanticsSetText>What this field does when a screen reader or a voice tool hands it
text. Compose’s setText.
set_selection: Option<SemanticsSetSelection>What this field does when a screen reader moves its caret or picks a
stretch of its text. Compose’s setSelection.
expand: Option<SemanticsExpand>What this control does when a screen reader asks it to open. A control
that says so reads as closed. Compose’s expand.
dismiss: Option<SemanticsDismiss>What this control does when a screen reader asks to send it away: a row
a sighted person swipes off, a sheet a sighted person taps outside of.
Compose’s dismiss.
collapse: Option<SemanticsExpand>What this control does when a screen reader asks it to close. A control
that says so reads as open. Compose’s collapse.
vertical_scroll: Option<ScrollAxisRange>How far this container scrolled up and down. Compose’s
verticalScrollAxisRange.
horizontal_scroll: Option<ScrollAxisRange>How far this container scrolled left and right. Compose’s
horizontalScrollAxisRange.
scroll_by: Option<SemanticsScrollBy>What this container does when a screen reader pages it. Compose’s
scrollBy.
scroll_to_index: Option<SemanticsScrollToIndex>What this list does when a screen reader asks for the row at an index,
so a reader reaches row 300 without paging to it. Compose’s
scrollToIndex.
collection: Option<CollectionInfo>How many rows and columns this list holds. Compose’s collectionInfo.