Skip to Content
CrowCrow

Accessibility, Semantics & Focus

Zero-overhead TalkBack AccessibilityNodeProvider, reactive Modifier.semantics, keyboard navigation, and FocusRequester.

Accessibility in Crow is built directly into CrowView via an AccessibilityNodeProvider over the LNode tree. It allocates zero accessibility objects until an assistive service (such as TalkBack or Switch Access) actually queries the tree.

Automatic Semantics from Unstyled Bases

Every unstyled component (ButtonBase, ToggleBase, SwitchBase, CheckboxBase, RadioButtonBase, Slider, tabs, dialogs, sheets) and every crow-material3 / crow-lens control automatically publishes:

  • Correct semantic roles (Button, Switch, Checkbox, RadioButton, Slider, Tab)
  • Live checked, selected, disabled, and adjustable range states
  • Click, long-click, scroll, expand, collapse, dismiss, and text-editing actions
  • Compose-style semantic merging for labeled controls

Custom Semantics (Modifier.semantics)

Attach reactive labels, headings, state descriptions, live regions, or custom actions to any node:

Box(
    Modifier
        .clickable { toggleFavorite() }
        .semantics {
            contentDescription { if (favorite) "Remove from favorites" else "Add to favorites" }
            stateDescription { if (favorite) "Saved" else "Not saved" }
            liveRegion = LiveRegion.Polite
        },
) {
    Icon(
        symbol = Symbols.Rounded.Favorite,
        style = if (favorite) SymbolStyle.Filled else SymbolStyle.Regular,
    )
}
  • Tracked like graphicsLayer: When favorite flips, only the semantic metadata updates and announces appropriately to TalkBack — zero layout or draw pass.
  • Subtree exclusion: Dormant NavHost screens, hidden Loading regions, exiting AnimatedVisibility ghosts, and inert screens beneath modal overlays are automatically hidden from TalkBack explore-by-touch.
  • clearAndSetSemantics: Replace descendant semantics when a composite card should be read as one coherent announcement.

Keyboard Navigation & Focus

Crow includes a built-in FocusManager supporting hardware keyboards, D-pads, and accessibility traversal:

  • Modifier.focusable() participates in tree-order Tab / Shift+Tab traversal and tracks Interaction.FOCUSED / Interaction.FOCUS_VISIBLE.
  • FocusRequester lets you programmatically move focus (for example, focusing a search input when a sheet opens).
  • Modifier.onKeyEvent { ... } handles Enter, Space, Escape, and arrow keys directly on the focused node.
  • Overlays automatically save focus on open, clear it (dismissing the IME), and restore focus to the trigger control when dismissed.

How is this guide?

On this page