From d362e496eb77049b04d9ca2fe679a2f5790351c5 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Mon, 12 May 2025 15:09:18 -0700 Subject: [PATCH] Fix string comparison when self has accessibility order reference (#51270) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51270 I was informed that we could not reference ourselves with accessibility order when using `useID`. The reason for that ended up being because of this if statement which uses `==`. Note this worked with a normal string like `"foo"` but `useID` has ids like `"<>"` so I imagine the < and > made this break. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D74601689 fbshipit-source-id: 25adc84248fbfcaff36607d18c170e6c8000cffb --- .../Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index d8c416133c4..777428c3772 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -1161,7 +1161,7 @@ static RCTBorderStyle RCTBorderStyleFromOutlineStyle(OutlineStyle outlineStyle) for (auto childId : _props->accessibilityOrder) { NSString *nsStringChildId = RCTNSStringFromString(childId); // Special case to allow for self-referencing with accessibilityOrder - if (nsStringChildId == self.nativeId) { + if ([nsStringChildId isEqualToString:self.nativeId]) { if (!_axElementDescribingSelf) { _axElementDescribingSelf = [[RCTViewAccessibilityElement alloc] initWithView:self]; }