Skip to content

fix(accessibility): Derive accessibilityTraits from role and state (#57515)#57516

Open
cgoldsby wants to merge 1 commit into
react:mainfrom
cgoldsby:feature/RN-57515-derived-accessibility-traits
Open

fix(accessibility): Derive accessibilityTraits from role and state (#57515)#57516
cgoldsby wants to merge 1 commit into
react:mainfrom
cgoldsby:feature/RN-57515-derived-accessibility-traits

Conversation

@cgoldsby

Copy link
Copy Markdown

Replaces the two independent writers on accessibilityTraits (one in C++ for role, one in ObjC for state) with a single deriveAccessibilityTraits() helper that rebuilds the full mask from None each commit.

On recycled Fabric views, the ObjC writer's diff guard can skip when the stale _props match the new props, leaving Selected and NotEnabled traits stale.

Fixes #57515

Changelog:

[IOS] [FIXED] - Derive accessibilityTraits from role and state in a single writer so Selected and NotEnabled traits are not lost on recycled Fabric views

Test Plan:

Reproducer repo: https://github.com/cgoldsby/rn-accessibility-traits-bug ([steps](https://github.com/cgoldsby/rn-accessibility-traits-bug#steps-to-reproduce-bug))

git clone https://github.com/cgoldsby/rn-accessibility-traits-bug.git
cd rn-accessibility-traits-bug
yarn install
cd ios && pod install && cd ..
yarn ios
  1. Open Accessibility Inspector
  2. Focus the target View
  3. Tap "Toggle Role" to switch from role="button" to no role

Before fix: Selected trait is missing
After fix:

git apply patches/react-native+0.86.0.patch
cd ios && pod install && cd ..
yarn ios

Selected trait persists through the role change

@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 Jul 10, 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 Jul 10, 2026
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.

[iOS][Fabric] A recycled Fabric iOS view can lose the Selected accessibility trait after reuse

1 participant