Skip to content

Hide ScrollView and ActivityIndicator content when aria-hidden is set - #59072

Draft
YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/scroll-view-aria-hidden
Draft

YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/scroll-view-aria-hidden

Conversation

@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor

Summary:

ScrollView and ActivityIndicator hand their props to a native component without the translation View gives aria-hidden, so the native side gets a prop it does not read and their content stays reachable by TalkBack and VoiceOver. #53364 closed the same gap for Text, TextInput and Image.

ScrollView now maps aria-hidden to importantForAccessibility="no-hide-descendants" and accessibilityElementsHidden, as View does. ActivityIndicator hands it to the View that wraps its indicator, which applies the same mapping. RNTester's aria-hidden example gains a ScrollView and an ActivityIndicator.

Left out: Switch, which takes keyboard focus; RefreshControl, which on Android wraps its scroll view, so hiding it would hide the scrolled content there and not on iOS; DrawerLayoutAndroid and ProgressBarAndroid, which are deprecated.

Changelog:

[GENERAL] [FIXED] - aria-hidden support for ScrollView and ActivityIndicator

Test Plan:

  • Fantom: new cases in ScrollView-itest.js and ActivityIndicator-itest.js. Without the change the two mapping cases fail, the host rendering no importantForAccessibility; with it yarn fantom ScrollView ActivityIndicator-itest View-itest passes 329 tests in 8 suites. Run in reactnativecommunity/react-native-android:latest, the image build_fantom_runner uses.
  • yarn lint, yarn flow-check, yarn format-check-javascript, yarn test-ci (244 suites), yarn build-types (no change to the generated types) and yarn test-generated-typescript pass in the same image.
  • RNTester, APIs → Accessibility → aria-hidden, on an Android 16 emulator with TalkBack and aria-hidden on: touching the scroll view's text or the indicator moves TalkBack's focus onto it without the change, and leaves it where it was with the change. Images in the comment below.
  • Not run on iOS; the mapping there is the one View uses.

ScrollView and ActivityIndicator hand their props to a native component
without the translation View applies, so aria-hidden reached the native
side as a prop it does not read and the content stayed visible to
TalkBack and VoiceOver. ScrollView now maps it to
importantForAccessibility="no-hide-descendants" and
accessibilityElementsHidden, as View does, and ActivityIndicator passes
it to the View that wraps its indicator. RNTester's aria-hidden example
gains a ScrollView and an ActivityIndicator.
@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 14, 2026
@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

Device evidence — before / after

UNFIXED — with aria-hidden on, touching the text in the ScrollView or the ActivityIndicator moves TalkBack's focus onto it.

FIXED — the focus stays on the switch it was on.

before — main at f7cb270fba after — with this PR
text in a hidden ScrollView
hidden ActivityIndicator

RNTester debug builds of main at f7cb270fba with the new example rows, without and with this change, on an Android 16 (API 36) emulator, 1140×2400 at density 480. With aria-hidden on, TalkBack's focus is first put on the switch and the screen is then touched at the scroll view's text or at the indicator: without the change the focus moves to the hidden element, with it the focus stays on the switch. A second round put the focus in the same place in every frame.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant