Skip to main content

A11yBuilder

Struct A11yBuilder 

Source
pub struct A11yBuilder { /* private fields */ }
Expand description

The annotations .a11y(|a| …) collects (docs/accessibility.md). The three strings are TextSources, so each takes a literal, a String, a Signal<String> or a closure: a gauge’s value follows the gauge, and a localized label follows the locale.

Implementations§

Source§

impl A11yBuilder

Source

pub fn label<M>(self, s: impl IntoText<M>) -> Self

What the screen reader calls the element.

Source

pub fn hint<M>(self, s: impl IntoText<M>) -> Self

A longer description of what the element does.

Source

pub fn value<M>(self, s: impl IntoText<M>) -> Self

The control’s current value read aloud by the screen reader (e.g. a Meter’s “72%”). Reactive like the others: .value(move || format!("{:.0}%", level.get())) re-sends the value whenever level changes.

Source

pub fn role(self, r: Role) -> Self

Source

pub fn selected<M>(self, on: impl IntoReactive<bool, M>) -> Self

Whether this element is the selected one among its peers (a Role::Tab, a row): the platform’s selected state, which a screen reader reads as “selected”. Reactive like the strings: .selected(move || current.get() == key) re-sends it when the selection moves.

Source

pub fn hidden(self) -> Self

Hide this element from assistive tech (still visible on screen), e.g. a redundant chrome element already announced by its labeled sibling.

Source

pub fn decorative(self) -> Self

Purely decorative (a background flourish): hidden from assistive tech and, for images, exempt from the “needs a label” lint (§13).

Trait Implementations§

Source§

impl Default for A11yBuilder

Source§

fn default() -> A11yBuilder

Returns the “default value” for a type. Read more

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
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.
Day API ↩ Guides· daybrite.dev