Bug 1292573 - Broken keyboard interaction with the subview in the Downloads Panel. r?paolo
MozReview-Commit-ID: 3jiqzlzLuWM
--- 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;