Skip to content

Test aria-hidden on ScrollView and ActivityIndicator - #59072

Merged
Abbondanzo merged 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/scroll-view-aria-hidden
Dec 3, 2026
Merged

Abbondanzo merged 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/scroll-view-aria-hidden

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

#59379 maps aria-hidden on ScrollView and ActivityIndicator through resolveAriaProps, without a test for it. This adds the cases:

  • ScrollView: aria-hidden maps to importantForAccessibility="no-hide-descendants", the mapping resets when aria-hidden is removed, and an explicit importantForAccessibility is kept when aria-hidden is absent or false.
  • ActivityIndicator: aria-hidden maps to importantForAccessibility="no-hide-descendants", and resets when aria-hidden is removed.

RNTester's aria-hidden example gains a ScrollView and an ActivityIndicator.

Related: #59052 takes the descendants of a no-hide-descendants view, scroll views among them, out of Android's keyboard navigation.

Changelog:

[Internal] - Add aria-hidden tests for ScrollView and ActivityIndicator

Test Plan:

  • Fantom, in reactnativecommunity/react-native-android:latest, the image build_fantom_runner uses: ScrollView-itest.js and ActivityIndicator-itest.js pass on main at b49769c0cc. With the aria-hidden branch of resolveAriaProps removed, the four mapping and reset cases fail at their mapping assertion; with importantForAccessibility cleared whenever aria-hidden is not true, the two ScrollView cases that keep an explicit value fail.
  • ESLint and Prettier pass over the changed files, and yarn flow-check passes.

@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

YevheniiKotyrlo commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

The screenshots and the iOS table below were taken on this PR's earlier heads, 89d056266a for Android and a669d1bd1f for iOS, which carried its own mapping; "after" and "with this PR" are those heads. main now maps aria-hidden through #59379: on the same iOS test screen, main with #59379 at c0aa2718ac (with-59379.xml in pr-59072) puts each of the four rows in or out of the tree as the after column does. The Android pair was not taken again on main.

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 ScrollView and ActivityIndicator rows this PR adds to the aria-hidden example, without and with this change, on an Android 16 (API 36) emulator, 1140×2400 at density 480. With the example's aria-hidden switch on, TalkBack's focus is first put on that switch, and the screen is then touched at the scroll view's text or at the indicator through TalkBack's explore-by-touch: without the change the focus moves to the hidden element, with it the focus stays on the switch. A second run put the focus in the same place in every screenshot.

iOS — the accessibility tree, before / after

UNFIXED — the text in a ScrollView with aria-hidden and an ActivityIndicator with aria-hidden are in the accessibility tree.

FIXED — neither is, and with aria-hidden={false} and accessibilityElementsHidden={true} given together, both are in it, as on a View.

In the accessibility tree before — main at b23e9a2677 after — with this PR
text in a ScrollView with aria-hidden in out
ActivityIndicator with aria-hidden in out
text in a ScrollView with aria-hidden={false} and accessibilityElementsHidden={true} out in
ActivityIndicator with aria-hidden={false} and accessibilityElementsHidden={true} out in

RNTester's Release build from a newer main than the Android pair's, b23e9a2677, without and with this change, on an iPad Pro (12.9-inch, 4th generation) with iOS 27.2, with a test screen holding these cases in place of RNTester's root; each tree is the hierarchy XCUITest reads, through WebDriverAgent's GET /source. On the same screen, text in a View with aria-hidden is out of the tree on both builds. accessibilityElementsHidden is iOS-only, so the last two rows have no Android counterpart. The test screen, the trees and the steps are in pr-59072, with the same screen built with #59379, which overlaps this change, and with #59381, which makes the UIActivityIndicatorView the accessibility element.

@YevheniiKotyrlo

YevheniiKotyrlo commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

#59379, opened after this one, overlaps it: it maps aria-hidden on ScrollView and ActivityIndicator too, along with the other aria-* props, through a shared helper. I'll leave it to you which one to keep, and I'm happy to close this one if #59379 is merged.

@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/scroll-view-aria-hidden branch from 89d0562 to a669d1b Compare November 1, 2026 23:23
@YevheniiKotyrlo
YevheniiKotyrlo marked this pull request as ready for review November 2, 2026 09:52
@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 Nov 2, 2026
@faciledictu

Copy link
Copy Markdown
Contributor

Thanks for checking #59379 and #59381 on the iPad too, and sorry for stepping on this one. #59379 has no aria-hidden tests and no RNTester example, so yours would still be useful on top of it.

@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

No worries — if #59379 lands first, I'll rebase this one onto it and keep only the aria-hidden tests and the RNTester example rows.

meta-codesync Bot pushed a commit that referenced this pull request Nov 30, 2026
## Summary:

Part of #59377.

`Switch`, `ScrollView` and `ActivityIndicator` render a native component directly, not a `View`, so `aria-*`, `id` and `tabIndex` reach the native side under their web-style names, which the native side does not read. `<Switch aria-label="Wi-Fi" />` has no label (Android marks it `NAF`), while `accessibilityLabel` works; the same for `ActivityIndicator` and `ScrollView`.

This change moves the conversion `View` does into `resolveAriaProps` (`src/private/components/view`) and uses it in the three components. The logic is copied from `View.js` unchanged, so the props behave the same as on `View`. `View.js` itself is not changed here, to stay clear of #59102; it can switch to the helper afterwards.

Overlap: #59072 maps `aria-hidden` on `ScrollView` and `ActivityIndicator`. This change covers it as well (and also on `Switch`, which #59072 leaves out on purpose); happy to rebase on it or drop the overlap, whichever the maintainers prefer. `RefreshControl` and `Modal` are left out: `Modal` is not an accessibility element, and `RefreshControl` wraps the scroll view on Android.

## Changelog:

[GENERAL] [FIXED] - `aria-*`, `id` and `tabIndex` on `Switch`, `ScrollView` and `ActivityIndicator` reach the native view

## Test Plan:

- `yarn fantom packages/react-native/Libraries/Components/Switch packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-itest.js packages/react-native/Libraries/Components/ActivityIndicator`: 3 suites, 24 tests passed.
- `yarn flow-check`: no errors. `yarn eslint` on the changed files: no warnings.
- On a device: https://github.com/faciledictu/rn-aria-props-repro, pairs A–F. Before: A, C and E have no `content-desc` in `uiautomator dump` (Android 17 emulator); on iOS A has no label (pairs C–F do not apply on iOS, see the issue). After, on iOS 27: A's label is "Wi-Fi A". After, on Android 17: A's `content-desc` is "Wi-Fi A" (no longer `NAF`), C's is "Loading C", E's is "Photos E", matching the `accessibility*` controls B, D, F.

Differential Revision: D129043804

Pull Request resolved: #59379
@Abbondanzo

Copy link
Copy Markdown
Contributor

#59379 has landed--could you rebase and keep the tests? Happy to import

@YevheniiKotyrlo
YevheniiKotyrlo marked this pull request as draft December 1, 2026 17:16
@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/scroll-view-aria-hidden branch from 0e359c3 to 8408860 Compare December 1, 2026 17:50
@YevheniiKotyrlo YevheniiKotyrlo changed the title Hide ScrollView and ActivityIndicator content when aria-hidden is set Test aria-hidden on ScrollView and ActivityIndicator Dec 1, 2026
@YevheniiKotyrlo
YevheniiKotyrlo marked this pull request as ready for review December 1, 2026 17:55
@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

Rebased onto main: the PR now holds only the aria-hidden cases in ScrollView-itest.js and ActivityIndicator-itest.js and the two RNTester rows.

resolveAriaProps maps aria-hidden on ScrollView and ActivityIndicator
since react#59379, with no test for it. Fantom cases now cover the mapping to
importantForAccessibility="no-hide-descendants" and its reset when the
prop is removed, and, on ScrollView, an explicit importantForAccessibility
kept when aria-hidden is absent or false. RNTester's aria-hidden example
gains a ScrollView and an ActivityIndicator.
@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/scroll-view-aria-hidden branch from 8408860 to 1c79356 Compare December 1, 2026 20:42
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Visual regression

No visual differences at 1c79356296c0.

@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

The two red checks are iOS Maestro failures in flows this change doesn't reach:

  • test_e2e_ios_rntester: the Debug leg failed alert.yml and filter-animated-blur.yml on both attempts (job); the Release leg passed both.
  • test_visual_ios_rntester / capture_ios: switch.yml failed all three attempts (job).

Each flow opens its own example by deep link, so the AccessibilityExample rows never render in them. main's run on the same base passed both jobs. I can't rerun them from a fork.

@Abbondanzo
Abbondanzo merged commit 400035a into react:main Dec 3, 2026
181 of 187 checks passed
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.

3 participants