pub enum SemanticsWidgetRole {
Show 21 variants
Button,
Checkbox,
Switch,
RadioButton,
Tab,
Image,
DropdownList,
ValuePicker,
Header,
Dialog,
Link,
SearchField,
ProgressBar,
ToggleButton,
Alert,
Toolbar,
Menu,
MenuItem,
TabBar,
List,
ListItem,
}Expand description
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.
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 more