Skip to main content

describe

Function describe 

pub fn describe(node: &AccessNode) -> String
Expand description

Compose the spoken phrase for an accessible node — the pure, heavily unit-tested core of the screen reader.

Segments join in order: name, value (protected contributes “protected” instead), role word, states (dimmed last), then position-in-set and hierarchy level. Empty segments are dropped.

use tilo_ui::a11y::{AccessNode, AccessState, Role};
use tilo_ui::screen_reader::describe;

let node = AccessNode::new(Role::Checkbox)
    .with_name("Accept")
    .with_state(AccessState::new().checked(true).disabled(true));
assert_eq!(describe(&node), "Accept, checkbox, checked, dimmed");