diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index d432aec07daf..26f6042e74ee 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -557,7 +557,7 @@ var BrowserPageActions = { */ mainButtonClicked(event) { event.stopPropagation(); - if ((event.type == "click" && event.button != 0) || + if ((event.type == "mousedown" && event.button != 0) || (event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE && event.keyCode != KeyEvent.DOM_VK_RETURN)) { return; diff --git a/browser/components/customizableui/CustomizableUI.jsm b/browser/components/customizableui/CustomizableUI.jsm index 246391f6fc6e..774d49d600c8 100644 --- a/browser/components/customizableui/CustomizableUI.jsm +++ b/browser/components/customizableui/CustomizableUI.jsm @@ -4230,6 +4230,9 @@ OverflowableToolbar.prototype = { this._enable(); break; case "mousedown": + if (aEvent.button != 0) { + break; + } if (aEvent.target == this._chevron) { this._onClickChevron(aEvent); } else { diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js index 20a7255f975f..24ed29d42c6f 100644 --- a/browser/components/customizableui/content/panelUI.js +++ b/browser/components/customizableui/content/panelUI.js @@ -359,6 +359,9 @@ const PanelUI = { let domEvent = null; if (aEvent) { + if (aEvent.type == "mousedown" && aEvent.button != 0) { + return; + } if (aEvent.type == "command" && aEvent.inputSource != null) { // Synthesize a new DOM mouse event to pass on the inputSource. domEvent = document.createEvent("MouseEvent"); diff --git a/browser/components/downloads/content/indicator.js b/browser/components/downloads/content/indicator.js index abcf3a0a1efe..948d93680d92 100644 --- a/browser/components/downloads/content/indicator.js +++ b/browser/components/downloads/content/indicator.js @@ -504,6 +504,10 @@ const DownloadsIndicatorView = { }, onCommand(aEvent) { + if (aEvent.type == "mousedown" && aEvent.button != 0) { + return; + } + // If the downloads button is in the menu panel, open the Library let widgetGroup = CustomizableUI.getWidget("downloads-button"); if (widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) { diff --git a/browser/components/downloads/test/browser/browser_overflow_anchor.js b/browser/components/downloads/test/browser/browser_overflow_anchor.js index 5135e774194c..503610f21d49 100644 --- a/browser/components/downloads/test/browser/browser_overflow_anchor.js +++ b/browser/components/downloads/test/browser/browser_overflow_anchor.js @@ -38,7 +38,7 @@ add_task(async function test_overflow_anchor() { await waitForOverflowed(button, true); let promise = promisePanelOpened(); - button.node.dispatchEvent(new Event("mousedown")); + EventUtils.sendMouseEvent({ type: "mousedown", button: 0 }, button.node); await promise; let panel = DownloadsPanel.panel; @@ -58,7 +58,7 @@ add_task(async function test_overflow_anchor() { // Now try opening the panel again. promise = promisePanelOpened(); - button.node.dispatchEvent(new Event("mousedown")); + EventUtils.sendMouseEvent({ type: "mousedown", button: 0 }, button.node); await promise; is(panel.anchorNode.id, "downloads-indicator-anchor");