Repository navigation
Test aria-hidden on ScrollView and ActivityIndicator - #59072
Conversation
|
The screenshots and the iOS table below were taken on this PR's earlier heads, Device evidence — before / afterUNFIXED — with aria-hidden on, touching the text in the FIXED — the focus stays on the switch it was on.
RNTester debug builds of iOS — the accessibility tree, before / afterUNFIXED — the text in a FIXED — neither is, and with
RNTester's Release build from a newer |
89d0562 to
a669d1b
Compare
a669d1b to
0e359c3
Compare
|
No worries — if #59379 lands first, I'll rebase this one onto it and keep only the |
## 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
|
#59379 has landed--could you rebase and keep the tests? Happy to import |
0e359c3 to
8408860
Compare
|
Rebased onto |
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.
8408860 to
1c79356
Compare
Visual regressionNo visual differences at |
|
The two red checks are iOS Maestro failures in flows this change doesn't reach:
Each flow opens its own example by deep link, so the |




Summary:
#59379 maps
aria-hiddenonScrollViewandActivityIndicatorthroughresolveAriaProps, without a test for it. This adds the cases:ScrollView:aria-hiddenmaps toimportantForAccessibility="no-hide-descendants", the mapping resets whenaria-hiddenis removed, and an explicitimportantForAccessibilityis kept whenaria-hiddenis absent orfalse.ActivityIndicator:aria-hiddenmaps toimportantForAccessibility="no-hide-descendants", and resets whenaria-hiddenis removed.RNTester's aria-hidden example gains a
ScrollViewand anActivityIndicator.Related: #59052 takes the descendants of a
no-hide-descendantsview, scroll views among them, out of Android's keyboard navigation.Changelog:
[Internal] - Add
aria-hiddentests forScrollViewandActivityIndicatorTest Plan:
reactnativecommunity/react-native-android:latest, the imagebuild_fantom_runneruses:ScrollView-itest.jsandActivityIndicator-itest.jspass onmainatb49769c0cc. With thearia-hiddenbranch ofresolveAriaPropsremoved, the four mapping and reset cases fail at their mapping assertion; withimportantForAccessibilitycleared wheneveraria-hiddenis nottrue, the twoScrollViewcases that keep an explicit value fail.yarn flow-checkpasses.