Bug 1390356: Do not focus BottomSheetDialog in Talkback. r=sebastian draft
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 21 Aug 2017 14:40:08 -0700
changeset 650188 21b7312808389d8079c132bfa7dd79819463d82a
parent 650187 a6ee7a68e7f1ab8ec4099b4a0d0b02c808e83ff6
child 650189 f13c2cc8e28f133fe267f8f08df16900dd711ba3
push id75295
push usermichael.l.comella@gmail.com
push dateTue, 22 Aug 2017 01:14:07 +0000
reviewerssebastian
bugs1390356
milestone57.0a1
Bug 1390356: Do not focus BottomSheetDialog in Talkback. r=sebastian MozReview-Commit-ID: 5ZlKzq46tXC
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/menu/BottomSheetContextMenu.java
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/menu/BottomSheetContextMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/menu/BottomSheetContextMenu.java
@@ -141,16 +141,25 @@ import java.net.URISyntaxException;
             // https://android.googlesource.com/platform/frameworks/support/+/461d9c4b4b51cd552fc890d7feb001c6bd2097ea/design/res/layout/design_bottom_sheet_dialog.xml
             // I opted not to update to save time (we have an AS deadline) and to prevent possible regressions.
             final View tapToDismissView = window.findViewById(android.support.design.R.id.touch_outside);
             if (tapToDismissView != null) {
                 tapToDismissView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
             } else {
                 isSuccess = false;
             }
+
+            // We don't want to directly focus the dialog: just the list items.
+            // It's unclear if this is also fixed in the newer source code.
+            final View dialogView = window.findViewById(android.support.design.R.id.design_bottom_sheet);
+            if (dialogView != null) {
+                dialogView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+            } else {
+                isSuccess = false;
+            }
         }
 
         if (!isSuccess) {
             Log.w(LOGTAG, "Unable to fully override Activity Stream bottom sheet accessibility behavior.");
         }
     }
 
     public void dismiss() {