From 5741f771562962110e105114a2c65def4baa805b Mon Sep 17 00:00:00 2001 From: Ziqi Chen Date: Mon, 16 Jul 2018 19:14:06 -0700 Subject: [PATCH] added image button role on android Summary: Because we're now separating accessibilityTraits into accessibilityRole and accessibilityState, we're going to only allow one role to be set, and allow on preset combinations of roles that make sense. This adds android functionality for an added role that is image button. Reviewed By: blavalla Differential Revision: D8846987 fbshipit-source-id: 9fe36828f63b05bd2c9cf9680204b1995d678342 --- .../com/facebook/react/uimanager/AccessibilityRoleUtil.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityRoleUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityRoleUtil.java index 86095befc..949e009d8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityRoleUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityRoleUtil.java @@ -34,6 +34,7 @@ public class AccessibilityRoleUtil { LINK("android.widget.Button"), SEARCH("android.widget.EditText"), IMAGE("android.widget.ImageView"), + IMAGEBUTTON("android.widget.ImageView"), KEYBOARDKEY("android.inputmethodservice.Keyboard$Key"), TEXT("android.widget.ViewGroup"), ADJUSTABLE("android.widget.SeekBar"); @@ -91,6 +92,10 @@ public class AccessibilityRoleUtil { if (role.equals(AccessibilityRole.IMAGE)) { nodeInfo.setRoleDescription("Image"); } + if (role.equals(AccessibilityRole.IMAGEBUTTON)) { + nodeInfo.setRoleDescription("Button Image"); + nodeInfo.setClickable(true); + } if (role.equals(AccessibilityRole.ADJUSTABLE)) { nodeInfo.setRoleDescription("Adjustable"); }