diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java index 110b933f15d999..25579c4c292f6b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java @@ -167,7 +167,17 @@ public void setViewState(@NonNull T view, @Nullable ReadableMap accessibilitySta return; } if (accessibilityState.hasKey("selected")) { - view.setSelected(accessibilityState.getBoolean("selected")); + boolean prevSelected = view.isSelected(); + boolean nextSelected = accessibilityState.getBoolean("selected"); + view.setSelected(nextSelected); + + // For some reason, Android does not announce "unselected" when state changes. + // This is inconsistent with other platforms, but also with the "checked" state. + // So manually announce this. + if (view.isAccessibilityFocused() && prevSelected && !nextSelected) { + view.announceForAccessibility( + view.getContext().getString(R.string.state_unselected_description)); + } } else { view.setSelected(false); } diff --git a/ReactAndroid/src/main/res/views/uimanager/values/strings_unlocalized.xml b/ReactAndroid/src/main/res/views/uimanager/values/strings_unlocalized.xml index 4c18708bf3ef81..a904f57856fb2a 100644 --- a/ReactAndroid/src/main/res/views/uimanager/values/strings_unlocalized.xml +++ b/ReactAndroid/src/main/res/views/uimanager/values/strings_unlocalized.xml @@ -92,6 +92,10 @@ name="state_collapsed_description" translatable="false" >collapsed + unselected