Skip to content

Commit 81f1469

Browse files
committed
fix(iOS): do not force accessibilityRespondsToUserInteraction on recycle
Its UIKit default is not a fixed YES but derived from other accessibility properties (UIAccessibility.h: "default == derived from other accessibility properties", e.g. NotEnabled elements return NO). Writing an explicit constant on recycle would permanently replace the derived behavior, so move it to the skipped-on-purpose list alongside isAccessibilityElement and accessibilityTraits.
1 parent c4ab261 commit 81f1469

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,14 +744,18 @@ - (void)prepareForRecycle
744744
// UIImageView whose natural a11y behavior would be clobbered
745745
// by forcing NO / None here. Per-subclass reset is a separate
746746
// follow-up.
747+
// * `accessibilityRespondsToUserInteraction` — its UIKit default is
748+
// not a fixed value but "derived from other accessibility
749+
// properties" (per the UIAccessibility.h header; e.g. an element
750+
// with UIAccessibilityTraitNotEnabled returns NO). Writing any
751+
// explicit value here would replace the derived behavior with a
752+
// constant, which is worse than the staleness it would fix.
747753
self.accessibilityElement.accessibilityLabel = nil;
748754
self.accessibilityElement.accessibilityLanguage = nil;
749755
self.accessibilityElement.accessibilityHint = nil;
750756
self.accessibilityElement.accessibilityValue = nil;
751757
self.accessibilityElement.accessibilityViewIsModal = NO;
752758
self.accessibilityElement.accessibilityElementsHidden = NO;
753-
// UIView default for accessibilityRespondsToUserInteraction is YES.
754-
self.accessibilityElement.accessibilityRespondsToUserInteraction = YES;
755759
self.accessibilityIgnoresInvertColors = NO;
756760
// Clear only the `accessibilityState` bits the setter writes via
757761
// self.accessibilityTraits (.NotEnabled / .Selected). Subclass

0 commit comments

Comments
 (0)