Bug 1315201: 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 651661 4c02c8b477d071ff8014c0b9ec6863a996bc2c82
parent 651660 60f757b5f890d3e8fce71adad959123b51122a16
child 651662 408a34e0974d263432ed7f4e50996b4fca61b52b
push id75787
push usermichael.l.comella@gmail.com
push dateWed, 23 Aug 2017 22:00:44 +0000
reviewerssebastian
bugs1315201
milestone57.0a1
Bug 1315201: 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() {