Skip to content

fix(iOS): reset accessibilityViewIsModal on view recycle to avoid trapping VoiceOver#57196

Open
doracawl wants to merge 1 commit into
react:mainfrom
doracawl:fix-accessibilityViewIsModal-recycle
Open

fix(iOS): reset accessibilityViewIsModal on view recycle to avoid trapping VoiceOver#57196
doracawl wants to merge 1 commit into
react:mainfrom
doracawl:fix-accessibilityViewIsModal-recycle

Conversation

@doracawl

@doracawl doracawl commented Jun 13, 2026

Copy link
Copy Markdown

Summary

RCTViewComponentView applies accessibilityViewIsModal in updateProps only when the prop changes:

// `accessibilityViewIsModal`
if (oldViewProps.accessibilityViewIsModal != newViewProps.accessibilityViewIsModal) {
  self.accessibilityElement.accessibilityViewIsModal = newViewProps.accessibilityViewIsModal;
}

…but prepareForRecycle never resets it. So when a view that had aria-modal / accessibilityViewIsModal is recycled and later reused for a different view that does not set the prop, the diff is NO (recycled default) == NO (new) and updateProps skips it — the stale accessibilityViewIsModal = YES leaks onto the recycled view.

A leftover modal view makes UIKit treat its subtree as the only accessible content, so VoiceOver and UI automation see an empty accessibility tree for the rest of the window until an unrelated layout pass recovers it.

This is easy to hit with transparent modals (e.g. a react-native-screens transparentModal) on iOS: open a modal → close it → reopen it. The recycled content view keeps the stale flag and competes with the modal's own transition view, collapsing the whole window's accessibility tree. It is intermittent because it depends on which pooled view instance is reused.

Changelog:

[iOS] [Fixed] - Reset accessibilityViewIsModal in prepareForRecycle so a stale modal flag no longer leaks onto recycled views and traps VoiceOver

Test Plan

Repro (iOS, Fabric):

  1. Render a <View aria-modal> (for example the content of a transparent modal), then unmount it so its underlying RCTViewComponentView returns to the recycle pool.
  2. Mount other content that reuses the recycled view without aria-modal.
  • Before: the reused view still reports accessibilityViewIsModal == YES; VoiceOver / Accessibility Inspector / a maestro hierarchy dump show a collapsed (near-empty) accessibility tree for the window.
  • After: the reused view reports accessibilityViewIsModal == NO; the accessibility tree is intact.

Verified on an iOS 26 simulator with a transparent-modal open → close → reopen cycle: UI-automation flows that read the accessibility tree go from intermittently failing to passing every run.

@meta-cla

meta-cla Bot commented Jun 13, 2026

Copy link
Copy Markdown

Hi @doracawl!

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!

@meta-cla

meta-cla Bot commented Jun 13, 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 Jun 13, 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 Jun 13, 2026

@tijuas16 tijuas16 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.

Trabajo realizado

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