Skip to content

fix: map aria-* props in Switch, ScrollView and ActivityIndicator - #59379

Open
faciledictu wants to merge 2 commits into
react:mainfrom
faciledictu:fix/aria-native-components
Open

faciledictu wants to merge 2 commits into
react:mainfrom
faciledictu:fix/aria-native-components

Conversation

@faciledictu

@faciledictu faciledictu commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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.

@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
@faciledictu
faciledictu force-pushed the fix/aria-native-components branch from ed90278 to 0c00807 Compare October 25, 2026 09:33
@github-actions

Copy link
Copy Markdown

Visual regression

No visual differences at 0c008070adc5.

ios: no capture

@faciledictu
faciledictu force-pushed the fix/aria-native-components branch from 0c00807 to ab85ded Compare November 1, 2026 09:25
faciledictu and others added 2 commits November 1, 2026 21:34
These components render a native component directly instead of a View,
so the aria-*, id and tabIndex props reach the native side unconverted
and are dropped. Move the conversion View does into a helper and use it
in the three components.
@faciledictu
faciledictu force-pushed the fix/aria-native-components branch from ab85ded to c0aa271 Compare November 1, 2026 17:41
@faciledictu

Copy link
Copy Markdown
Contributor Author

Rebased on main and added aria-modal to resolveAriaProps. #59328 added the aria-modal → accessibilityViewIsModal mapping to View.js after the helper was written, so the two no longer matched. Now the conversion is the same as in View again, and switching View.js to the helper later stays a refactor with no change in behavior.

@meta-codesync

meta-codesync Bot commented Nov 2, 2026

Copy link
Copy Markdown

@javache has imported this pull request. If you are a Meta employee, you can view this in D129043804.

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.

2 participants