pub enum SemanticsWidgetRole {
Show 22 variants
Button,
Checkbox,
Switch,
RadioButton,
Tab,
Image,
DropdownList,
ValuePicker,
Header,
Dialog,
Link,
SearchField,
ProgressBar,
ToggleButton,
Alert,
Toolbar,
Menu,
MenuItem,
TabBar,
List,
ListItem,
RadioGroup,
}Expand description
Re-export the UI crate so applications can depend on a single crate. What kind of control a node is, as screen readers announce it.
This is Compose’s SemanticsProperties.Role (Modifier.semantics { role = Role.RadioButton }), not a description of where the node sits in the tree.
A screen reader turns it into the trailing noun it speaks after the label —
TalkBack says “CAMPAIGN, radio button, selected” — and into the on/off
wording it uses for a switch. Compose keeps this separate from the node’s
structural kind for the same reason Cranpose does: a Row that happens to
be clickable is still a row, and a drawn ring segment that is a radio button
has no layout node of its own at all.
Variants§
Button
Checkbox
Switch
RadioButton
Tab
Image
DropdownList
A control that opens a list of choices and holds the one that is
picked. Compose’s Role.DropdownList.
ValuePicker
A control that holds one value out of an ordered set and steps through
them. Compose’s Role.ValuePicker.
Header
Compose’s heading(), which is a property rather than a Role, but
reaches the platform through the same field on every backend Cranpose
targets (AccessibilityNodeInfo.setHeading, Role::Heading,
<h*>/UIAccessibilityTraitHeader).
Dialog
A modal surface that takes over the screen until it is dismissed. Screen readers announce it and confine their traversal to it, which is the accessible half of what makes a dialog modal.
Link
Text that takes the user somewhere else when pressed. Compose has no
such Role; SwiftUI’s .isLink, ARIA’s link.
SearchField
A field that narrows what is on the screen as the user types. ARIA’s
searchbox, VoiceOver’s search field trait.
ProgressBar
A control that shows how far work has come and takes no input. ARIA’s
progressbar.
ToggleButton
A button that stays pressed or released. ARIA’s button with
aria-pressed.
Alert
A message a reader speaks as soon as it shows, with no move to it.
ARIA’s alert.
Toolbar
A row of controls that act on the content beside them. ARIA’s
toolbar.
Menu
A list of commands that opens on a press. ARIA’s menu.
MenuItem
One command inside a menu. ARIA’s menuitem.
TabBar
The row that holds the tabs of a screen. ARIA’s tablist, VoiceOver’s
tab bar trait.
List
A container whose rows a reader counts and walks into. ARIA’s list.
ListItem
One row of a list. ARIA’s listitem.
RadioGroup
A set of mutually exclusive radio choices. ARIA’s radiogroup.
Trait Implementations§
Source§impl Clone for SemanticsWidgetRole
impl Clone for SemanticsWidgetRole
Source§fn clone(&self) -> SemanticsWidgetRole
fn clone(&self) -> SemanticsWidgetRole
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SemanticsWidgetRole
Source§impl Debug for SemanticsWidgetRole
impl Debug for SemanticsWidgetRole
impl Eq for SemanticsWidgetRole
Source§impl Hash for SemanticsWidgetRole
impl Hash for SemanticsWidgetRole
Source§impl PartialEq for SemanticsWidgetRole
impl PartialEq for SemanticsWidgetRole
impl StructuralPartialEq for SemanticsWidgetRole
Auto Trait Implementations§
impl Freeze for SemanticsWidgetRole
impl RefUnwindSafe for SemanticsWidgetRole
impl Send for SemanticsWidgetRole
impl Sync for SemanticsWidgetRole
impl Unpin for SemanticsWidgetRole
impl UnsafeUnpin for SemanticsWidgetRole
impl UnwindSafe for SemanticsWidgetRole
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.