Bug 1395871 - Open pageAction menus on mousedown, rather than oncommand.
MozReview-Commit-ID: 7i2kHcpZOPf
--- a/browser/base/content/browser-pageActions.js
+++ b/browser/base/content/browser-pageActions.js
@@ -355,17 +355,24 @@ var BrowserPageActions = {
buttonNode.addEventListener("contextmenu", event => {
BrowserPageActions.onContextMenu(event);
});
if (action.nodeAttributes) {
for (let name in action.nodeAttributes) {
buttonNode.setAttribute(name, action.nodeAttributes[name]);
}
}
- buttonNode.addEventListener("click", event => {
+
+ // The `activationEvent` should be `mousedown` if the only
+ // result of the click is the opening of a submenu.
+ //
+ // If the button has an additional action, this code will need to
+ // get additional parameter to recognize which event to use.
+ const activationEvent = action.subview ? "mousedown" : "click";
+ buttonNode.addEventListener(activationEvent, event => {
if (event.button != 0) {
return;
}
if (action.subview || action.wantsIframe) {
this._toggleActivatedActionPanelForAction(action);
return;
}
action.onCommand(event, buttonNode);