Skip to content

Commit 51c53b7

Browse files
committed
fix(iOS): reset accessibilityViewIsModal on view recycle
1 parent 066c0d8 commit 51c53b7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,13 @@ - (void)prepareForRecycle
723723
_removeClippedSubviews = NO;
724724
_reactSubviews = [NSMutableArray new];
725725
_layoutMetrics = {};
726+
727+
// Reset accessibilityViewIsModal so it does not leak across recycled views.
728+
// updateProps only writes this property when (oldProps != newProps); after a
729+
// view is recycled _props resets to the default (NO), so a recycled view that
730+
// is reused without the prop keeps the stale YES and traps VoiceOver / UI
731+
// automation against a now-unrelated subtree (empty accessibility tree).
732+
self.accessibilityElement.accessibilityViewIsModal = NO;
726733
}
727734

728735
- (void)setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:(NSSet<NSString *> *_Nullable)props

0 commit comments

Comments
 (0)