Skip to main content

AccessibilityState

Enum AccessibilityState 

Source
#[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§

§

Unavailable = 0

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 Expanded for 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 the Selected state 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 Linked object 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

Source§

fn clone(&self) -> AccessibilityState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccessibilityState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromIterator<AccessibilityState> for AccessibilityStateVec

Source§

fn from_iter<T>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for AccessibilityState

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for AccessibilityState

Source§

fn cmp(&self, other: &AccessibilityState) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for AccessibilityState

Source§

fn eq(&self, other: &AccessibilityState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for AccessibilityState

Source§

fn partial_cmp(&self, other: &AccessibilityState) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for AccessibilityState

Source§

impl Eq for AccessibilityState

Source§

impl StructuralPartialEq for AccessibilityState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetHash for T
where T: Hash,

Source§

fn get_hash(&self) -> u64

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.