pub struct SemanticsConfiguration {Show 42 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<bool>,
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 password: bool,
pub traversal_index: f32,
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>,
}Expand description
Semantics configuration for accessibility.
Fields§
§content_description: Option<String>§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>§toggled: Option<bool>§enabled: bool§is_clickable: bool§is_editable_text: bool§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>§custom_actions: Vec<SemanticsCustomAction>§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.
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.
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.
Implementations§
Source§impl SemanticsConfiguration
impl SemanticsConfiguration
Sourcepub fn new() -> SemanticsConfiguration
pub fn new() -> SemanticsConfiguration
An empty spec to build on. Every field is what it is with no semantics declared at all.
Sourcepub fn content_description(
self,
name: impl Into<String>,
) -> SemanticsConfiguration
pub fn content_description( self, name: impl Into<String>, ) -> SemanticsConfiguration
The name a screen reader reads for the control. Compose’s
contentDescription.
Sourcepub fn state_description(
self,
state: impl Into<String>,
) -> SemanticsConfiguration
pub fn state_description( self, state: impl Into<String>, ) -> SemanticsConfiguration
What the control says about itself after its name. Compose’s
stateDescription.
Sourcepub fn clickable(self) -> SemanticsConfiguration
pub fn clickable(self) -> SemanticsConfiguration
A screen reader offers to activate the control. Compose’s onClick.
Sourcepub fn on_click(
self,
label: impl Into<String>,
action: impl Fn() + 'static,
) -> SemanticsConfiguration
pub fn on_click( self, label: impl Into<String>, action: impl Fn() + 'static, ) -> SemanticsConfiguration
Handles keyboard and screen-reader activation without adding a pointer gesture. An empty label uses the platform’s default activation instruction.
Sourcepub fn on_long_click(
self,
label: impl Into<String>,
action: impl Fn() -> bool + 'static,
) -> SemanticsConfiguration
pub fn on_long_click( self, label: impl Into<String>, action: impl Fn() -> bool + 'static, ) -> SemanticsConfiguration
What the control does when a screen reader asks for its long press,
and the verb phrase a reader reads out for it. Compose’s
onLongClick(label) { … }.
Sourcepub fn on_magic_tap(
self,
label: impl Into<String>,
action: impl Fn() -> bool + 'static,
) -> SemanticsConfiguration
pub fn on_magic_tap( self, label: impl Into<String>, action: impl Fn() -> bool + 'static, ) -> SemanticsConfiguration
What the control does on VoiceOver’s magic tap, and the verb phrase
the other platforms list it under. SwiftUI’s
accessibilityAction(.magicTap).
Sourcepub fn input_labels<S>(
self,
labels: impl IntoIterator<Item = S>,
) -> SemanticsConfiguration
pub fn input_labels<S>( self, labels: impl IntoIterator<Item = S>, ) -> SemanticsConfiguration
The short names a person says to Voice Control to reach the control.
SwiftUI’s accessibilityInputLabels.
Sourcepub fn language(self, tag: impl Into<String>) -> SemanticsConfiguration
pub fn language(self, tag: impl Into<String>) -> SemanticsConfiguration
The language of the control’s text, as a BCP 47 tag. SwiftUI’s
accessibilityLanguage, ARIA’s lang.
Sourcepub fn toggled(self, toggled: bool) -> SemanticsConfiguration
pub fn toggled(self, toggled: bool) -> SemanticsConfiguration
Whether the control is on or off. Compose’s toggleableState.
Sourcepub fn selected(self, selected: bool) -> SemanticsConfiguration
pub fn selected(self, selected: bool) -> SemanticsConfiguration
Whether the control is the one picked out of a group. Compose’s
selected.
Sourcepub fn role(self, role: SemanticsWidgetRole) -> SemanticsConfiguration
pub fn role(self, role: SemanticsWidgetRole) -> SemanticsConfiguration
What kind of control a screen reader reads this as. Compose’s Role.
Sourcepub fn heading(self) -> SemanticsConfiguration
pub fn heading(self) -> SemanticsConfiguration
Reads as a heading, so a reader can jump between the headings of a
screen. Compose’s heading().
Sourcepub fn error(self, message: impl Into<String>) -> SemanticsConfiguration
pub fn error(self, message: impl Into<String>) -> SemanticsConfiguration
Why the control’s content is wrong. Compose’s error.
Sourcepub fn password(self) -> SemanticsConfiguration
pub fn password(self) -> SemanticsConfiguration
Holds a secret, so no reader reads the text out. Compose’s password.
Sourcepub fn pane_title(self, title: impl Into<String>) -> SemanticsConfiguration
pub fn pane_title(self, title: impl Into<String>) -> SemanticsConfiguration
Names the screen or pane this node is the root of. Compose’s
paneTitle.
Sourcepub fn traversal_index(self, index: f32) -> SemanticsConfiguration
pub fn traversal_index(self, index: f32) -> SemanticsConfiguration
Where a reader visits this node among the ones beside it. Compose’s
traversalIndex.
Skips this node and everything under it. Compose’s
hideFromAccessibility.
Sourcepub fn merge_descendants(self) -> SemanticsConfiguration
pub fn merge_descendants(self) -> SemanticsConfiguration
Takes this node and the text under it as one stop. Compose’s
mergeDescendants.
Sourcepub fn selectable_group(self) -> SemanticsConfiguration
pub fn selectable_group(self) -> SemanticsConfiguration
Makes the selectable controls under this node one group. Compose’s
selectableGroup.
Sourcepub fn live_region(self, mode: LiveRegionMode) -> SemanticsConfiguration
pub fn live_region(self, mode: LiveRegionMode) -> SemanticsConfiguration
Reads this node again whenever its text changes. Compose’s
liveRegion.
pub fn merge(&mut self, other: &SemanticsConfiguration)
Sourcepub fn is_activatable(&self) -> bool
pub fn is_activatable(&self) -> bool
Whether a screen reader should offer activation. A named click label is
how Compose declares onClick, so it implies the action the same way.
Trait Implementations§
Source§impl Clone for SemanticsConfiguration
impl Clone for SemanticsConfiguration
Source§fn clone(&self) -> SemanticsConfiguration
fn clone(&self) -> SemanticsConfiguration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SemanticsConfiguration
impl Debug for SemanticsConfiguration
Source§impl Default for SemanticsConfiguration
impl Default for SemanticsConfiguration
Source§fn default() -> SemanticsConfiguration
fn default() -> SemanticsConfiguration
Source§impl PartialEq for SemanticsConfiguration
impl PartialEq for SemanticsConfiguration
impl StructuralPartialEq for SemanticsConfiguration
Auto Trait Implementations§
impl !RefUnwindSafe for SemanticsConfiguration
impl !Send for SemanticsConfiguration
impl !Sync for SemanticsConfiguration
impl !UnwindSafe for SemanticsConfiguration
impl Freeze for SemanticsConfiguration
impl Unpin for SemanticsConfiguration
impl UnsafeUnpin for SemanticsConfiguration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.