Skip to content

Map role="slider" to the adjustable accessibility trait on iOS - #59463

Open
jeltehomminga wants to merge 1 commit into
react:mainfrom
jeltehomminga:fix/ios-slider-role-adjustable
Open

jeltehomminga wants to merge 1 commit into
react:mainfrom
jeltehomminga:fix/ios-slider-role-adjustable

Conversation

@jeltehomminga

Copy link
Copy Markdown

Summary:

Hi, I'm a React Native developer. Thanks for the recent iOS accessibility work.

On iOS, role="slider" ends up with no accessibility traits, so VoiceOver doesn't treat the view as adjustable. accessibilityRole="adjustable" on the same view works. The traits come from fromString(const std::string &, AccessibilityTraits &) in accessibilityPropsConversions.h, which has an "adjustable" case but no "slider" case.

Before the ARIA roles moved to native in #37309, the JS mapping turned role: 'slider' into accessibilityRole: 'adjustable', so this used to work. The native table maps slider to no trait instead. This adds slider to the adjustable case, the same way img/image and heading/header share a case. Android doesn't read accessibilityTraits, so only iOS changes.

It only touches slider. The other roles listed in #50123 stay as they are, since the comment above RCTViewIsInteractiveAccessibilityElement says some of them carry no trait on purpose. I also left the legacy RCTViewManager.m table alone, which maps slider to UIAccessibilityTraitNone as well. Happy to change that one too if it's still wanted.

Part of #50123.

Changelog:

[IOS] [FIXED] - role="slider" now gets the adjustable accessibility trait, like accessibilityRole="adjustable"

Test Plan:

RNTester on an iPhone 18 Pro simulator (iOS 27.0), with the Playground rendering:

<View accessible role="slider" accessibilityLabel="Role slider" accessibilityValue={{min: 0, max: 10, now: 5}} />
<View accessible accessibilityRole="adjustable" accessibilityLabel="AccessibilityRole adjustable" accessibilityValue={{min: 0, max: 10, now: 5}} />

The simulator's accessibility tree for both views:

main     Role slider                   AXGroup       traits: none
         AccessibilityRole adjustable  AXAdjustable  traits: adjustable
this PR  Role slider                   AXAdjustable  traits: adjustable
         AccessibilityRole adjustable  AXAdjustable  traits: adjustable
  • Added derives_adjustable_trait_from_slider_role to AccessibilityPropsTest.cpp, next to derives_traits_from_role. I couldn't run it, because I didn't find a way to run the ReactCommon gtests from the open-source checkout.
  • node scripts/clang-format.js --check passes on both files.
  • Not checked: the legacy architecture.

`role="slider"` resolves to no accessibility traits on iOS, so VoiceOver
does not treat the view as adjustable, while `accessibilityRole="adjustable"`
does. Before the ARIA roles moved to native, the JS mapping turned
`role: 'slider'` into `accessibilityRole: 'adjustable'`.

Add `slider` to the `adjustable` case of the traits `fromString`, the same
way `img`/`image` and `heading`/`header` share a case.
Copilot AI balanced review requested due to automatic review settings October 25, 2026 07:24
@meta-cla

meta-cla Bot commented Oct 25, 2026

Copy link
Copy Markdown

Hi @jeltehomminga!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow mapping change follows the existing conversion pattern and includes a focused regression test; native tests were not executed during review.

No open issues 🎉

What changed in this PR

This PR restores the iOS adjustable accessibility trait for role="slider" in Fabric, addressing the slider portion of #50123 without changing other role mappings or the legacy architecture.

Changes:

  • Maps slider to AccessibilityTraits::Adjustable, alongside adjustable.
  • Adds a regression test for trait derivation from role="slider".
File Description
packages/​react-native/​ReactCommon/​react/​renderer/​components/​view/​tests/​AccessibilityPropsTest.cpp Adds a slider-role regression test.
packages/​react-native/​ReactCommon/​react/​renderer/​components/​view/​accessibilityPropsConversions.h Maps slider to the adjustable trait.

Review effort: Balanced

@meta-cla

meta-cla Bot commented Oct 25, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 25, 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 25, 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.

2 participants