Skip to main content

AccessibilityExt

Trait AccessibilityExt 

pub trait AccessibilityExt: Sized {
    // Required method
    fn get_accessibility_data(&mut self) -> &mut AccessibilityData;

    // Provided methods
    fn accessibility(self, accessibility: AccessibilityData) -> Self { ... }
    fn a11y_id(self, a11y_id: impl Into<Option<NodeId>>) -> Self { ... }
    fn a11y_focusable(self, a11y_focusable: impl Into<Focusable>) -> Self { ... }
    fn a11y_auto_focus(self, a11y_auto_focus: impl Into<bool>) -> Self { ... }
    fn a11y_member_of(self, a11y_member_of: impl Into<NodeId>) -> Self { ... }
    fn a11y_role(self, a11y_role: impl Into<Role>) -> Self { ... }
    fn a11y_alt(self, value: impl Into<Box<str>>) -> Self { ... }
    fn a11y_builder(self, with: impl FnOnce(&mut Node)) -> Self { ... }
}
Expand description

Methods for describing an element in the accessibility tree.

Required Methods§

fn get_accessibility_data(&mut self) -> &mut AccessibilityData

Returns a mutable reference to the element’s accessibility data.

Provided Methods§

fn accessibility(self, accessibility: AccessibilityData) -> Self

Replace all of the element’s accessibility data at once. See AccessibilityData.

fn a11y_id(self, a11y_id: impl Into<Option<NodeId>>) -> Self

Set an explicit accessibility id instead of an autogenerated one. See AccessibilityId.

fn a11y_focusable(self, a11y_focusable: impl Into<Focusable>) -> Self

Set whether the element can receive keyboard focus. See Focusable.

fn a11y_auto_focus(self, a11y_auto_focus: impl Into<bool>) -> Self

Request that the element be focused automatically when it is mounted.

fn a11y_member_of(self, a11y_member_of: impl Into<NodeId>) -> Self

Mark the element as a member of the group identified by the given AccessibilityId.

fn a11y_role(self, a11y_role: impl Into<Role>) -> Self

Set the accessibility role exposed in the accessibility tree. See AccessibilityRole.

fn a11y_alt(self, value: impl Into<Box<str>>) -> Self

Set the text label that describes the element in the accessibility tree.

fn a11y_builder(self, with: impl FnOnce(&mut Node)) -> Self

Edit the underlying accesskit node directly for advanced accessibility properties.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§