Skip to content

Commit 399285f

Browse files
kaciebfacebook-github-bot
authored andcommitted
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
1 parent 5d01110 commit 399285f

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java

-4
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,14 @@ public static void setRole(
385385
spannable.setSpan(new URLSpan(""), 0, spannable.length(), 0);
386386
nodeInfo.setText(spannable);
387387
}
388-
} else if (role.equals(AccessibilityRole.SEARCH)) {
389-
nodeInfo.setRoleDescription(context.getString(R.string.search_description));
390388
} else if (role.equals(AccessibilityRole.IMAGE)) {
391389
nodeInfo.setRoleDescription(context.getString(R.string.image_description));
392390
} else if (role.equals(AccessibilityRole.IMAGEBUTTON)) {
393391
nodeInfo.setRoleDescription(context.getString(R.string.imagebutton_description));
394392
nodeInfo.setClickable(true);
395393
} else if (role.equals(AccessibilityRole.BUTTON)) {
396-
nodeInfo.setRoleDescription(context.getString(R.string.button_description));
397394
nodeInfo.setClickable(true);
398395
} else if (role.equals(AccessibilityRole.TOGGLEBUTTON)) {
399-
nodeInfo.setRoleDescription(context.getString(R.string.toggle_button_description));
400396
nodeInfo.setClickable(true);
401397
nodeInfo.setCheckable(true);
402398
} else if (role.equals(AccessibilityRole.SUMMARY)) {

ReactAndroid/src/main/res/views/uimanager/values/strings_unlocalized.xml

-12
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,10 @@
44
name="link_description"
55
translatable="false"
66
>Link</string>
7-
<string
8-
name="search_description"
9-
translatable="false"
10-
>Search Field</string>
117
<string
128
name="image_description"
139
translatable="false"
1410
>Image</string>
15-
<string
16-
name="button_description"
17-
translatable="false"
18-
>Button</string>
19-
<string
20-
name="toggle_button_description"
21-
translatable="false"
22-
>Toggle Button</string>
2311
<string
2412
name="imagebutton_description"
2513
translatable="false"

0 commit comments

Comments
 (0)