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 `"<<r0>>"` so I imagine the < and > made this break.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D74601689

fbshipit-source-id: 25adc84248fbfcaff36607d18c170e6c8000cffb
This commit is contained in:
Joe Vilches
2025-05-12 15:09:18 -07:00
committed by Facebook GitHub Bot
parent af4cfbf03f
commit d362e496eb
@@ -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];
}