Skip to content

Commit fafcfcd

Browse files
rozelemeta-codesync[bot]
authored andcommitted
Do not include an expanded property by default in accessibilityState (#56814)
Summary: Pull Request resolved: #56814 Any time we have a non-nullable accessibilityState prop, it appears to always set `expanded` false, which causes most Android screen readers to append or prepend "collapsed". This fixes the issue. ## Changelog [Android][Fixed] Screen reader behavior for accessibilityState expanded Reviewed By: javache Differential Revision: D105035390 fbshipit-source-id: 4b3b1b2a9b6e661cfde0f39d7de6a7cd7af91bb0
1 parent 37be935 commit fafcfcd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view

packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,9 @@ inline static void updateAccessibilityStateProp(
456456
}
457457

458458
if (!oldState.has_value() || newState->expanded != oldState->expanded) {
459-
resultState["expanded"] =
460-
newState->expanded.has_value() && newState->expanded.value();
459+
if (newState->expanded.has_value()) {
460+
resultState["expanded"] = newState->expanded.value();
461+
}
461462
}
462463

463464
if (!oldState.has_value() || newState->checked != oldState->checked) {

0 commit comments

Comments
 (0)