mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1287914 - Buttons in sliding panel overlay are not clickable. r=jaws
MozReview-Commit-ID: 91yoPxiMIy8
This commit is contained in:
parent
6dc54f7d80
commit
a21a61d78d
@ -1196,7 +1196,17 @@ const DownloadsViewController = {
|
|||||||
!(aCommand in DownloadsViewItem.prototype)) {
|
!(aCommand in DownloadsViewItem.prototype)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Secondly, determine if focus is on a control in the downloads list.
|
// The currently supported commands depend on whether the blocked subview is
|
||||||
|
// showing. If it is, then take the following path.
|
||||||
|
if (DownloadsBlockedSubview.view.showingSubView) {
|
||||||
|
let blockedSubviewCmds = [
|
||||||
|
"downloadsCmd_chooseOpen",
|
||||||
|
"cmd_delete",
|
||||||
|
];
|
||||||
|
return blockedSubviewCmds.indexOf(aCommand) >= 0;
|
||||||
|
}
|
||||||
|
// If the blocked subview is not showing, then determine if focus is on a
|
||||||
|
// control in the downloads list.
|
||||||
let element = document.commandDispatcher.focusedElement;
|
let element = document.commandDispatcher.focusedElement;
|
||||||
while (element && element != DownloadsView.richListBox) {
|
while (element && element != DownloadsView.richListBox) {
|
||||||
element = element.parentNode;
|
element = element.parentNode;
|
||||||
@ -1606,6 +1616,9 @@ const DownloadsBlockedSubview = {
|
|||||||
*/
|
*/
|
||||||
hide() {
|
hide() {
|
||||||
this.view.showMainView();
|
this.view.showMainView();
|
||||||
|
// The point of this is to focus the proper element in the panel now that
|
||||||
|
// the main view is showing again. showPanel handles that.
|
||||||
|
DownloadsPanel.showPanel();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +39,8 @@ add_task(function* mainTest() {
|
|||||||
// Click the Open button. The alert blocked-download dialog should be
|
// Click the Open button. The alert blocked-download dialog should be
|
||||||
// shown.
|
// shown.
|
||||||
let dialogPromise = promiseAlertDialogOpen("cancel");
|
let dialogPromise = promiseAlertDialogOpen("cancel");
|
||||||
DownloadsBlockedSubview.elements.openButton.click();
|
EventUtils.synthesizeMouse(DownloadsBlockedSubview.elements.openButton,
|
||||||
|
10, 10, {}, window);
|
||||||
yield dialogPromise;
|
yield dialogPromise;
|
||||||
|
|
||||||
window.focus();
|
window.focus();
|
||||||
@ -53,7 +54,8 @@ add_task(function* mainTest() {
|
|||||||
|
|
||||||
// Click the Remove button. The panel should close and the item should be
|
// Click the Remove button. The panel should close and the item should be
|
||||||
// removed from it.
|
// removed from it.
|
||||||
DownloadsBlockedSubview.elements.deleteButton.click();
|
EventUtils.synthesizeMouse(DownloadsBlockedSubview.elements.deleteButton,
|
||||||
|
10, 10, {}, window);
|
||||||
yield promisePanelHidden();
|
yield promisePanelHidden();
|
||||||
yield openPanel();
|
yield openPanel();
|
||||||
|
|
||||||
@ -150,16 +152,16 @@ function makeDownload(verdict) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function promiseSubviewShown(shown) {
|
function promiseSubviewShown(shown) {
|
||||||
|
// More terribleness, but I'm tired of fighting intermittent timeouts on try.
|
||||||
|
// Just poll for the subview and wait a second before resolving the promise.
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (shown == DownloadsBlockedSubview.view.showingSubView) {
|
let interval = setInterval(() => {
|
||||||
resolve();
|
if (shown == DownloadsBlockedSubview.view.showingSubView &&
|
||||||
|
!DownloadsBlockedSubview.view._transitioning) {
|
||||||
|
clearInterval(interval);
|
||||||
|
setTimeout(resolve, 1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let event = shown ? "ViewShowing" : "ViewHiding";
|
}, 0);
|
||||||
let subview = DownloadsBlockedSubview.subview;
|
|
||||||
subview.addEventListener(event, function showing() {
|
|
||||||
subview.removeEventListener(event, showing);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user