Skip to content

feat(renderer): add aria state props - #865

Open
patrickkabwe wants to merge 1 commit into
feat/a11y-rolefrom
feat/a11y-state
Open

patrickkabwe wants to merge 1 commit into
feat/a11y-rolefrom
feat/a11y-state

Conversation

@patrickkabwe

@patrickkabwe patrickkabwe commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #838 (step 4). Stacked on #864.

Views take aria-disabled, aria-selected, aria-checked (true, false or 'mixed'), aria-expanded and aria-busy.

<View
  accessible
  role="checkbox"
  aria-checked={done}
  gestureRecognizers={[toggleTap]}
>
  <Text>Water the plants</Text>
</View>
  • JS: each prop is a plain value, so the existing prop comparison only calls native when it changes. The native spec has one property per prop.
  • iOS: aria-disabled and aria-selected add the .notEnabled and .selected traits on top of the role's or view's own traits, stored in the AccessibilityAttributes struct from step 3. aria-checked, aria-busy, and aria-expanded before iOS 18 go into the accessibility value ("checked", "mixed, busy", ...). On iOS 18, aria-expanded sets accessibilityExpandedStatus.
  • Android: the node delegate sets enabled, selected, checkable and checked, and adds the expand or collapse action. The "mixed", "expanded"/"collapsed" and "busy" states go in the state description. A state change sends a content-changed event so TalkBack re-reads the node; View.sendAccessibilityEvent returns early when no accessibility service runs.
  • The state words are English for now, as there are no localized strings in the renderer yet.
  • aria-disabled only changes what the screen reader says. It doesn't block touches.
  • The Typography example's font toggle is a switch with aria-checked, and "Show every line" reports aria-expanded.

Tested on the iOS simulator: the switch reads checked and flips to unchecked when tapped. A temporary caption with every prop showed selected and notEnabled next to the label's own static text trait, and the value "mixed, busy". The inspector doesn't report accessibilityExpandedStatus, so the iOS 18 expanded path is only checked by compiling. On the Android emulator, uiautomator showed enabled=false, selected, checkable and checked as expected, and a temporary delegate log showed "collapsed" with the expand action, then "expanded" with the collapse action after tapping. TalkBack itself was not run.

Re-tested after the move to ARIA names and the rebase onto main: aria-checked reads checked and unchecked on iOS and flips checked on Android when tapped.

@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nitro-ui-docs Ready Ready Preview Dec 2, 2026 1:34pm UTC

Request Review

@patrickkabwe patrickkabwe changed the title feat(renderer): add accessibilityState prop feat(renderer): add aria state props Dec 2, 2026
@patrickkabwe
patrickkabwe added this pull request to stack #951 December 2, 2026 13:39
@patrickkabwe
patrickkabwe marked this pull request as ready for review December 2, 2026 13:39
@patrickkabwe
patrickkabwe requested a review from hannojg December 2, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant