Skip to content

Commit d362e49

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Fix string comparison when self has accessibility order reference (facebook#51270)
Summary: Pull Request resolved: facebook#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
1 parent af4cfbf commit d362e49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ - (NSObject *)accessibilityElement
11611161
for (auto childId : _props->accessibilityOrder) {
11621162
NSString *nsStringChildId = RCTNSStringFromString(childId);
11631163
// Special case to allow for self-referencing with accessibilityOrder
1164-
if (nsStringChildId == self.nativeId) {
1164+
if ([nsStringChildId isEqualToString:self.nativeId]) {
11651165
if (!_axElementDescribingSelf) {
11661166
_axElementDescribingSelf = [[RCTViewAccessibilityElement alloc] initWithView:self];
11671167
}

0 commit comments

Comments
 (0)