Bug 1292573 - Broken keyboard interaction with the subview in the Downloads Panel. r?paolo draft
authorDrew Willcoxon <adw@mozilla.com>
Fri, 26 Aug 2016 09:59:11 -0700
changeset 406242 09d68b1fc8abbcb5dc704cafb5ea2686fe47cdb6
parent 399976 6f2ba7787816fd01f77c30e3bdb68400db74bf0c
child 529597 5cd27d9ba748be31781b7a2e79e199c7a785d8ef
push id27660
push userdwillcoxon@mozilla.com
push dateFri, 26 Aug 2016 16:59:24 +0000
reviewerspaolo
bugs1292573
milestone51.0a1
Bug 1292573 - Broken keyboard interaction with the subview in the Downloads Panel. r?paolo MozReview-Commit-ID: 3jiqzlzLuWM
browser/components/downloads/content/downloads.css
browser/components/downloads/content/downloads.js
--- a/browser/components/downloads/content/downloads.css
+++ b/browser/components/downloads/content/downloads.css
@@ -225,8 +225,23 @@ richlistitem.download button {
 }
 
 /* The subview should leave the right edge of the main view uncovered. */
 #downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack > .panel-subviews {
   /* Use a margin instead of a transform like above so that the subview's width
      isn't wider than the panel. */
   -moz-margin-start: 38px !important;
 }
+
+/* Prevent keyboard interaction in the main view by preventing all elements in
+   the main view from being focused... */
+#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview #downloadsListBox,
+#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview richlistitem,
+#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview .downloadButton,
+#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview .downloadsPanelFooterButton,
+#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview #downloadsSummary {
+  -moz-user-focus: ignore;
+}
+/* ... except for the downloadShowBlockedInfo button in the blocked download.
+   Selecting it with the keyboard should show the main view again. */
+#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] .download-state[showingsubview] .downloadShowBlockedInfo {
+  -moz-user-focus: normal;
+}
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -1137,18 +1137,18 @@ DownloadsViewItem.prototype = {
     // their click has been received, and we're handling the action.
     // Otherwise, we'd have to wait for the operating system file manager
     // window to open before the panel closed. This also helps to prevent the
     // user from opening the containing folder several times.
     DownloadsPanel.hidePanel();
   },
 
   downloadsCmd_showBlockedInfo() {
-    DownloadsBlockedSubview.show(this.element,
-                                 ...this.rawBlockedTitleAndDetails);
+    DownloadsBlockedSubview.toggle(this.element,
+                                   ...this.rawBlockedTitleAndDetails);
   },
 
   downloadsCmd_openReferrer() {
     openURL(this.download.source.referrer);
   },
 
   downloadsCmd_copyLocation() {
     let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
@@ -1564,18 +1564,19 @@ const DownloadsBlockedSubview = {
    *
    * @param element
    *        The blocked-download richlistitem element that was clicked.
    * @param title
    *        The title to show in the subview.
    * @param details
    *        An array of strings with information about the block.
    */
-  show(element, title, details) {
+  toggle(element, title, details) {
     if (this.view.showingSubView) {
+      this.hide();
       return;
     }
 
     this.element = element;
     element.setAttribute("showingsubview", "true");
 
     let e = this.elements;
     let s = DownloadsCommon.strings;