Skip to content
Commitwise
Menu

Semantics tree (Compose)

Also called: Semantics

The description of a Compose UI's meaning (labels, roles, states, actions) used by accessibility services and UI tests.

Definition

Next to the UI tree, Compose builds a semantics tree. Built-in components fill it in; custom ones add properties with Modifier.semantics, toggleable or clickable. TalkBack reads it, Switch Access and Voice Access act on it, and UI tests find nodes in it, so a missing label is both an accessibility bug and a test failure.

In practice

A favorite heart drawn on a Canvas gets Modifier.toggleable(role = Role.Switch) so TalkBack says "Favorite, switch, on".

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.