From 254110bf0278c1e8e68fa1517aa3ab6a0754eee3 Mon Sep 17 00:00:00 2001 From: Brett Lavalla Date: Wed, 1 Nov 2023 05:46:53 -0700 Subject: [PATCH] Make 'none' AccessibilityRole return the class for View Summary: This changes the default behavior for a "NONE" accessibility role to match Googles implementation in ExploreByTouchHelper (https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/widget/ExploreByTouchHelper.java;drc=c7585d0e2f27f00c47802a78422228a81cf2c939;l=56?q=ExploreByTouchHelper). This also matches ReactNative's default behavior here as well: https://www.internalfb.com/code/fbsource/[199b5d1c47b224f2891b8cba33da90c5c8714a81]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java?lines=291 A role of "View" is a no-op behind the scenes for accessibility services, but making this a valid string rather than `null` will prevent potential crashed from systems expecting a string value to always exist from the "getClassName" method. For context on how large of a potential problem this is, see this post: https://fb.workplace.com/groups/sbteng/posts/1396301817590446 Reviewed By: ikenwoo Differential Revision: D50864782 fbshipit-source-id: 8b176ed9427f62a1d039b012d10ea889df4777e3 --- .../inspector/descriptors/utils/AccessibilityRoleUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/utils/AccessibilityRoleUtil.java b/android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/utils/AccessibilityRoleUtil.java index 4ad9ce960..64e75c430 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/utils/AccessibilityRoleUtil.java +++ b/android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/utils/AccessibilityRoleUtil.java @@ -34,7 +34,7 @@ public class AccessibilityRoleUtil { *

https://github.com/google/talkback/blob/master/compositor/src/main/res/raw/compositor.json */ public enum AccessibilityRole { - NONE(null, ""), + NONE("android.view.View", ""), BUTTON("android.widget.Button", "Button"), CHECK_BOX("android.widget.CompoundButton", "Check box"), DROP_DOWN_LIST("android.widget.Spinner", "Drop down list"),