Localize "search", "button", and "togglebutton" accessibility roles by using the platform roles

Summary:
Several accessibilityRole strings are hardcoded to only English on Android. Swap them to just use the platform constants. This way, TalkBack will handle translations.

This change swaps roles "search", "button", and "togglebutton" roles to use the platform description.

Changelog:
[Android][Changed] Localize "search", "button", and "togglebutton" accessibility roles by using the platform roles

Reviewed By: lunaleaps

Differential Revision: D28077246

fbshipit-source-id: 5b88a6fd7e78b3426506f253b823ecca0608c4bc
This commit is contained in:
Kacie Bawiec
2021-06-03 14:42:47 -07:00
committed by Facebook GitHub Bot
parent 5d01110b53
commit 399285f91c
2 changed files with 0 additions and 16 deletions
@@ -385,18 +385,14 @@ public class ReactAccessibilityDelegate extends AccessibilityDelegateCompat {
spannable.setSpan(new URLSpan(""), 0, spannable.length(), 0);
nodeInfo.setText(spannable);
}
} else if (role.equals(AccessibilityRole.SEARCH)) {
nodeInfo.setRoleDescription(context.getString(R.string.search_description));
} else if (role.equals(AccessibilityRole.IMAGE)) {
nodeInfo.setRoleDescription(context.getString(R.string.image_description));
} else if (role.equals(AccessibilityRole.IMAGEBUTTON)) {
nodeInfo.setRoleDescription(context.getString(R.string.imagebutton_description));
nodeInfo.setClickable(true);
} else if (role.equals(AccessibilityRole.BUTTON)) {
nodeInfo.setRoleDescription(context.getString(R.string.button_description));
nodeInfo.setClickable(true);
} else if (role.equals(AccessibilityRole.TOGGLEBUTTON)) {
nodeInfo.setRoleDescription(context.getString(R.string.toggle_button_description));
nodeInfo.setClickable(true);
nodeInfo.setCheckable(true);
} else if (role.equals(AccessibilityRole.SUMMARY)) {