#[repr(C)]pub enum AccessibilityState {
Show 16 variants
Unavailable = 0,
Selected = 1,
Focused = 2,
Checked = 3,
Readonly = 4,
Default = 5,
Expanded = 6,
Collapsed = 7,
Busy = 8,
Offscreen = 9,
Focusable = 10,
Selectable = 11,
Linked = 12,
Traversed = 13,
Multiselectable = 14,
Protected = 15,
}Expand description
Defines the current state of an element for accessibility APIs (e.g., focused, checked). These states provide dynamic information to assistive technologies about the element’s condition.
See the MSDN State Constants page for more details.
Variants§
The element is unavailable and cannot be interacted with.
- Purpose: To indicate that a control is disabled or grayed out.
- When to use: For disabled buttons, non-interactive menu items, or any control that is temporarily non-functional.
- Example: A “Save” button that is disabled until the user makes changes to a document.
Selected = 1
The element is selected.
- Purpose: To indicate that an item is currently chosen or highlighted. This is distinct from having focus.
- When to use: For selected items in a list, highlighted text, or the currently active tab in a tab list.
- Example: A file highlighted in a file explorer, or multiple selected emails in an inbox.
Focused = 2
The element has the keyboard focus.
- Purpose: To identify the single element that will receive keyboard input.
- When to use: For the control that is currently active and ready to be manipulated by the keyboard.
- Example: A text box with a blinking cursor, or a button with a dotted outline around it.
Checked = 3
The element is checked, toggled, or in a mixed state.
- Purpose: To represent the state of controls like checkboxes, radio buttons, and toggle buttons.
- When to use: For checkboxes that are ticked, selected radio buttons, or toggle buttons that are “on.”
- Example: A checked “I agree” checkbox, a selected “Yes” radio button, or an active “Bold” button in a toolbar.
Readonly = 4
The element’s content cannot be edited by the user.
- Purpose: To indicate that the element’s value can be viewed and copied, but not modified.
- When to use: For display-only text fields or documents.
- Example: A text box displaying a license agreement that the user can scroll through but cannot edit.
Default = 5
The element is the default action in a dialog or form.
- Purpose: To identify the button that will be activated if the user presses the Enter key.
- When to use: For the primary confirmation button in a dialog.
- Example: The “OK” button in a dialog box, which often has a thicker or colored border.
Expanded = 6
The element is expanded, showing its child items.
- Purpose: To indicate that a collapsible element is currently open and its contents are visible.
- When to use: For tree view nodes, combo boxes with their lists open, or expanded accordion panels.
- Example: A folder in a file explorer’s tree view that has been clicked to show its subfolders.
Collapsed = 7
The element is collapsed, hiding its child items.
- Purpose: To indicate that a collapsible element is closed and its contents are hidden.
- When to use: The counterpart to
Expandedfor any collapsible UI element. - Example: A closed folder in a file explorer’s tree view, hiding its contents.
Busy = 8
The element is busy and cannot respond to user interaction.
- Purpose: To indicate that the element or application is performing an operation and is temporarily unresponsive.
- When to use: When an application is loading, processing refany, or otherwise occupied.
- Example: A window that is grayed out and shows a spinning cursor while saving a large file.
Offscreen = 9
The element is not currently visible on the screen.
- Purpose: To indicate that an element exists but is currently scrolled out of the visible area.
- When to use: For items in a long list or a large document that are not within the current viewport.
- Example: A list item in a long dropdown that you would have to scroll down to see.
Focusable = 10
The element can accept keyboard focus.
- Purpose: To indicate that the user can navigate to this element using the keyboard (e.g., with the Tab key).
- When to use: On all interactive elements like buttons, links, and input fields, whether they currently have focus or not.
- Example: A button that can receive focus, even if it is not the currently focused element.
Selectable = 11
The element is a container whose children can be selected.
- Purpose: To indicate that the element contains items that can be chosen.
- When to use: On container controls like list boxes, tree views, or text spans where text can be highlighted.
- Example: A list box control is
Selectable, while its individual list items have theSelectedstate when chosen.
Linked = 12
The element is a hyperlink.
- Purpose: To identify an object that navigates to another resource or location when activated.
- When to use: On any object that functions as a hyperlink.
- Example: Text or an image that, when clicked, opens a web page.
Traversed = 13
The element is a hyperlink that has been visited.
- Purpose: To indicate that a hyperlink has already been followed by the user.
- When to use: On a
Linkedobject that the user has previously activated. - Example: A hyperlink on a web page that has changed color to show it has been visited.
Multiselectable = 14
The element allows multiple of its children to be selected at once.
- Purpose: To indicate that a container control supports multi-selection.
- When to use: On container controls like list boxes or file explorers that support multiple selections (e.g., with Ctrl-click).
- Example: A file list that allows the user to select several files at once for a copy operation.
Protected = 15
The element contains protected content that should not be read aloud.
- Purpose: To prevent assistive technologies from speaking the content of a sensitive field.
- When to use: Primarily for password input fields.
- Example: A password text box where typed characters are masked with asterisks or dots.
Trait Implementations§
Source§impl Clone for AccessibilityState
impl Clone for AccessibilityState
Source§fn clone(&self) -> AccessibilityState
fn clone(&self) -> AccessibilityState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccessibilityState
impl Debug for AccessibilityState
Source§impl FromIterator<AccessibilityState> for AccessibilityStateVec
impl FromIterator<AccessibilityState> for AccessibilityStateVec
Source§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = AccessibilityState>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = AccessibilityState>,
Source§impl Hash for AccessibilityState
impl Hash for AccessibilityState
Source§impl Ord for AccessibilityState
impl Ord for AccessibilityState
Source§fn cmp(&self, other: &AccessibilityState) -> Ordering
fn cmp(&self, other: &AccessibilityState) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for AccessibilityState
impl PartialEq for AccessibilityState
Source§impl PartialOrd for AccessibilityState
impl PartialOrd for AccessibilityState
impl Copy for AccessibilityState
impl Eq for AccessibilityState
impl StructuralPartialEq for AccessibilityState
Auto Trait Implementations§
impl Freeze for AccessibilityState
impl RefUnwindSafe for AccessibilityState
impl Send for AccessibilityState
impl Sync for AccessibilityState
impl Unpin for AccessibilityState
impl UnsafeUnpin for AccessibilityState
impl UnwindSafe for AccessibilityState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more