Fix Android accessibility descendant race in ReactViewGroup#56182
Closed
erickreutz wants to merge 2 commits intofacebook:mainfrom
Closed
Fix Android accessibility descendant race in ReactViewGroup#56182erickreutz wants to merge 2 commits intofacebook:mainfrom
erickreutz wants to merge 2 commits intofacebook:mainfrom
Conversation
Abbondanzo
reviewed
Mar 23, 2026
|
@Abbondanzo has imported this pull request. If you are a Meta employee, you can view this in D97861147. |
|
@Abbondanzo merged this pull request in e681736. |
Collaborator
|
This pull request was successfully merged by @erickreutz in e681736 When will my fix make it into a release? | How to file a pick request? |
3 tasks
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
Guard
ReactViewGroup.addChildrenForAccessibilityagainst transient non-descendant races during accessibility traversal on Android.This replaces direct
super.addChildrenForAccessibility(...)calls with a small wrapper that:IllegalArgumentExceptionIllegalArgumentExceptionsWhy
There are recurring crashes with stack traces ending in:
ViewGroup.offsetRectBetweenParentAndChild->offsetDescendantRectToMyCoords->addChildrenForAccessibility->IllegalArgumentException: parameter must be a descendant of this view.This can happen when accessibility is traversing children while views are being re-parented/removed.
Related reports:
OverKeyboardViewcrash witha11ykirillzyusko/react-native-keyboard-controller#962There is also precedent in RN for handling this class of non-descendant race defensively:
Scope
This is intentionally minimal and localized to accessibility child collection in
ReactViewGroup. Behavior is unchanged in the non-racy path.Changelog:
[Android] [Fixed] - Guard
ReactViewGroup.addChildrenForAccessibilityagainst transient non-descendant accessibility traversal crashes.Test Plan:
Validated in a downstream RN Android app on Android 16 with repeated sheet/modal open-close stress and active accessibility hierarchy traversal; crash reproduces before patch and no longer reproduces with this guard.