AriaAttributes

Struct AriaAttributes 

Source
pub struct AriaAttributes {
Show 23 fields pub role: Option<String>, pub label: Option<String>, pub described_by: Option<String>, pub hidden: bool, pub expanded: Option<bool>, pub selected: Option<bool>, pub checked: Option<AriaChecked>, pub pressed: Option<AriaChecked>, pub disabled: bool, pub required: bool, pub invalid: bool, pub value_now: Option<f64>, pub value_min: Option<f64>, pub value_max: Option<f64>, pub value_text: Option<String>, pub level: Option<u8>, pub pos_in_set: Option<u32>, pub set_size: Option<u32>, pub controls: Option<String>, pub has_popup: Option<String>, pub busy: bool, pub live: Option<AriaLive>, pub atomic: bool,
}
Expand description

ARIA attributes for a widget.

Fields§

§role: Option<String>

The ARIA role

§label: Option<String>

Accessible label

§described_by: Option<String>

Accessible description

§hidden: bool

Whether element is hidden from accessibility tree

§expanded: Option<bool>

Whether element is expanded (for expandable elements)

§selected: Option<bool>

Whether element is selected

§checked: Option<AriaChecked>

Whether element is checked (for checkboxes/switches)

§pressed: Option<AriaChecked>

Whether element is pressed (for toggle buttons)

§disabled: bool

Whether element is disabled

§required: bool

Whether element is required

§invalid: bool

Whether element is invalid

§value_now: Option<f64>

Current value for range widgets

§value_min: Option<f64>

Minimum value for range widgets

§value_max: Option<f64>

Maximum value for range widgets

§value_text: Option<String>

Text representation of value

§level: Option<u8>

Level (for headings)

§pos_in_set: Option<u32>

Position in set

§set_size: Option<u32>

Set size

§controls: Option<String>

Controls another element (ID reference)

§has_popup: Option<String>

Has popup indicator

§busy: bool

Is busy/loading

§live: Option<AriaLive>

Live region politeness

§atomic: bool

Atomic live region

Implementations§

Source§

impl AriaAttributes

Source

pub fn new() -> Self

Create new empty ARIA attributes.

Source

pub fn with_role(self, role: impl Into<String>) -> Self

Set the role.

Source

pub fn with_label(self, label: impl Into<String>) -> Self

Set the label.

Source

pub const fn with_hidden(self, hidden: bool) -> Self

Set hidden.

Source

pub const fn with_expanded(self, expanded: bool) -> Self

Set expanded state.

Source

pub const fn with_selected(self, selected: bool) -> Self

Set selected state.

Source

pub const fn with_checked(self, checked: AriaChecked) -> Self

Set checked state.

Source

pub const fn with_pressed(self, pressed: AriaChecked) -> Self

Set pressed state (for toggle buttons).

Source

pub const fn with_disabled(self, disabled: bool) -> Self

Set disabled state.

Source

pub const fn with_busy(self, busy: bool) -> Self

Set busy state.

Source

pub const fn with_atomic(self, atomic: bool) -> Self

Set atomic.

Source

pub fn with_range(self, min: f64, max: f64, now: f64) -> Self

Set range values.

Source

pub const fn with_value_now(self, value: f64) -> Self

Set current value.

Source

pub const fn with_value_min(self, value: f64) -> Self

Set minimum value.

Source

pub const fn with_value_max(self, value: f64) -> Self

Set maximum value.

Source

pub fn with_controls(self, controls: impl Into<String>) -> Self

Set controls reference.

Source

pub fn with_described_by(self, described_by: impl Into<String>) -> Self

Set described by reference.

Source

pub fn with_has_popup(self, has_popup: impl Into<String>) -> Self

Set has popup.

Source

pub const fn with_level(self, level: u8) -> Self

Set heading level.

Source

pub const fn with_pos_in_set(self, pos: u32, size: u32) -> Self

Set position in set.

Source

pub const fn with_live(self, live: AriaLive) -> Self

Set live region.

Source

pub fn to_html_attrs(&self) -> Vec<(String, String)>

Generate HTML ARIA attributes.

Source

pub fn to_html_string(&self) -> String

Generate HTML attribute string.

Trait Implementations§

Source§

impl Clone for AriaAttributes

Source§

fn clone(&self) -> AriaAttributes

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 AriaAttributes

Source§

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

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

impl Default for AriaAttributes

Source§

fn default() -> AriaAttributes

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
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, 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> 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.