Incular logoIncular
API ReferencePlatform & Testing

Semantics

Roles, actions, nodes, and widgets for the accessibility tree.

Desktop accessibility uses AccessKit; screen-reader behavior needs native validation. Semantics expose logical counts and materialized indices without one node per logical row.

Core types

TypePurpose
SemanticRoleButton, header, image, link, list, meter, progress, text, …
SemanticActionAction kinds + invocation payloads
SemanticActionKindEnumerated action vocabulary
SemanticNodeIdStable node identity
SemanticStateNode state snapshot
SemanticsTreeWhole-tree queries
use incular::prelude::*;
use incular::widgets::{ExcludeSemantics, MergeSemantics};

fn main() {
    let app = Application::new(|_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(
                Column::builder()
                    .main_axis_size(MainAxisSize::Min)
                    .spacing(8.0)
                    .children(Vec::<Widget>::from([
                        Semantics::new(Text::new("Close")).label("Close").into(),
                        MergeSemantics::new(Text::new("Merged")).into(),
                        ExcludeSemantics::new(Text::new("Art")).into(),
                    ]))
                    .build(),
            )
            .build()
            .into()
    })
    .expect("valid application");
    incular::run(app).expect("run application");
}

Widgets

label names the node; MergeSemantics fuses a subtree; ExcludeSemantics hides one — all exercised in the runnable program above.

CheckedState: Unchecked (default) / Checked / Indeterminate; is_checked(), From<bool>, displays "false" / "true" / "mixed".

Related: Desktop.

On this page