Skip to content

Commit

Permalink
Localize "search", "button", and "togglebutton" accessibility roles b…
Browse files Browse the repository at this point in the history
…y 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
  • Loading branch information
kacieb authored and facebook-github-bot committed Jun 3, 2021
1 parent 5d01110 commit 399285f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,18 +385,14 @@ public static void setRole(
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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@
name="link_description"
translatable="false"
>Link</string>
<string
name="search_description"
translatable="false"
>Search Field</string>
<string
name="image_description"
translatable="false"
>Image</string>
<string
name="button_description"
translatable="false"
>Button</string>
<string
name="toggle_button_description"
translatable="false"
>Toggle Button</string>
<string
name="imagebutton_description"
translatable="false"
Expand Down

0 comments on commit 399285f

Please sign in to comment.