Skip to content

Commit 9e85d9e

Browse files
Announce "collapsed" for aria-expanded={false} on iOS New Architecture
RCTViewComponentView only added the "expanded" accessibility value when expanded was true, so VoiceOver announced no state for aria-expanded={false}. The old-architecture RCTView announced both states. Add the missing branch, reusing the existing localized "collapsed" string. Fixes #58746
1 parent 085caf0 commit 9e85d9e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,9 +1614,11 @@ - (NSString *)accessibilityValue
16141614
addObject:RCTLocalizedString(
16151615
"mixed", "a checkbox, radio button, or other widget which is both checked and unchecked")];
16161616
}
1617-
if (accessibilityState.expanded.value_or(false)) {
1617+
if (accessibilityState.expanded.has_value()) {
16181618
[valueComponents
1619-
addObject:RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")];
1619+
addObject:accessibilityState.expanded.value()
1620+
? RCTLocalizedString("expanded", "a menu, dialog, accordian panel, or other widget which is expanded")
1621+
: RCTLocalizedString("collapsed", "a menu, dialog, accordian panel, or other widget which is collapsed")];
16201622
}
16211623

16221624
if (accessibilityState.busy) {

0 commit comments

Comments
 (0)