fix(iOS): preserve Selected accessibility trait on recycled Fabric views - #57810
Closed
stareezy-1 wants to merge 1 commit into
Closed
fix(iOS): preserve Selected accessibility trait on recycled Fabric views#57810stareezy-1 wants to merge 1 commit into
stareezy-1 wants to merge 1 commit into
Conversation
…cycled views When accessibilityTraits changes (role change), the writer replaces the full bitmask without Selected/NotEnabled. On a recycled view, if accessibilityState hasn't changed (stale props match new props), the state writer skips and the Selected trait is permanently lost. Re-apply the state bits (Selected/NotEnabled) from the current accessibilityState immediately after overwriting the role traits. This is idempotent when the state writer also fires. Fixes react#57515
|
Hi @stareezy-1, thanks for your interest in this issue. ❤️ Since this is a duplicate of #57516, let's close this PR. The referenced PR addresses a deep root issue by correcting duplicate writes for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
Selectedaccessibility trait being lost when a Fabric iOS view is recycled and its role changes whileaccessibilityState.selectedremainstrue.Fixes #57515
Changelog:
[IOS] [FIXED] - Accessibility Selected/NotEnabled traits are now preserved when a recycled Fabric view's role changes
Problem
In
RCTViewComponentView updateProps, two writers updateself.accessibilityTraits:accessibilityTraits(role change): replaces the full bitmask — does NOT includeSelected/NotEnabledaccessibilityState(state change): ORs inSelected/NotEnabledBoth diff against retained props. On a recycled view:
Button | Selected✅None✅Button. But retained props still showselected=truefrom lifecycle 1, so writer 2 skips. Selected is lost. ❌Solution
After the
accessibilityTraitswriter fires (role change), immediately re-applySelected/NotEnabledfrom the currentaccessibilityState. This is idempotent when the state writer also fires.Test Plan
accessibilityState.selected=truebut different role now retains theSelectedtrait