Skip to content

fix(Touchable): pass role and the missing aria props to the host view - #59378

Open
faciledictu wants to merge 2 commits into
react:mainfrom
faciledictu:fix/touchables-role-aria
Open

faciledictu wants to merge 2 commits into
react:mainfrom
faciledictu:fix/touchables-role-aria

Conversation

@faciledictu

Copy link
Copy Markdown

Summary:

Part of #59377.

Touchable* build their host view props from a fixed list, and some props they accept in their types never reach it:

  • role: none of TouchableOpacity, TouchableHighlight, TouchableNativeFeedback, TouchableWithoutFeedback passes it, so <TouchableOpacity role="button"> has no role while accessibilityRole="button" works.
  • TouchableWithoutFeedback drops aria-label.
  • TouchableHighlight drops aria-busy, aria-checked, aria-disabled, aria-expanded and aria-selected; the other three already map them.

This change passes role from all four, maps aria-label in TouchableWithoutFeedback (it wins over accessibilityLabel, as in View, and the child keeps its own label when neither is set) and maps the state props in TouchableHighlight the same way TouchableOpacity does. aria-labelledby is left to #58173.

The shared rolePropSuite now also runs for TouchableNativeFeedback and TouchableWithoutFeedback; before, it ran only for Text. It cannot run for TouchableOpacity and TouchableHighlight: Fantom reads the debug props of a view, and AccessibilityProps::getDebugProps does not include role, so role on their host view is checked on a device instead (pairs G / H of the reproducer).

Changelog:

[GENERAL] [FIXED] - role on Touchable*, aria-label on TouchableWithoutFeedback and aria-* state props on TouchableHighlight reach the native view

Test Plan:

  • yarn fantom packages/react-native/Libraries/Components/Touchable: 4 suites, 272 tests passed. (Locally with CXXFLAGS=-Wno-deprecated-literal-operator: Xcode 27.1 clang rejects the operator "" _json syntax of the bundled nlohmann_json 3.11.2 under -Werror; unrelated to this change.)
  • yarn flow-check: no errors. yarn eslint on the changed files: no warnings.
  • On a device: the reproducer https://github.com/faciledictu/rn-aria-props-repro, pairs G–L. Before: on Android 17, G is android.view.ViewGroup, I's content-desc is the child's "×", K has no checked; on iOS 27, G has no Button trait, I's label is "×", K's value has no "checked". After, on iOS 27: G has the Button trait, I's label is "Close I", K's value is "checkbox, checked". After, on Android 17: G is android.widget.Button, I's content-desc is "Close I", K is checkable="true" checked="true". Each matches its accessibility* control (H, J, L).

faciledictu and others added 2 commits October 22, 2026 20:47
Touchable* copy a fixed list of props to their host view. role is not on
any of the lists, TouchableWithoutFeedback drops aria-label and
TouchableHighlight drops aria-busy, aria-checked, aria-disabled,
aria-expanded and aria-selected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzPpDcGNgvkkyMFtCXhLDi
The debug props of a view do not include role, so Fantom cannot see it on
the host view of TouchableOpacity and TouchableHighlight. Keep the suite
for TouchableNativeFeedback and TouchableWithoutFeedback, which pass role
to their Text child.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzPpDcGNgvkkyMFtCXhLDi
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 22, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant