From c089f0385539a6f23a71123272f90cc1f5206bb2 Mon Sep 17 00:00:00 2001 From: Gabriel Luong Date: Tue, 26 Sep 2017 08:43:22 -0400 Subject: [PATCH] Bug 1402709 - Don't use capture for the toolbox context menu. r=bgrins --- devtools/client/framework/toolbox.js | 5 ++--- devtools/client/inspector/inspector.js | 8 ++++++++ devtools/client/inspector/rules/rules.js | 9 +++++++++ devtools/client/sourceeditor/editor.js | 5 +++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js index 2c16e4178c2d..2063806149f5 100644 --- a/devtools/client/framework/toolbox.js +++ b/devtools/client/framework/toolbox.js @@ -453,13 +453,12 @@ Toolbox.prototype = { if (e.originalTarget.closest("input[type=text]") || e.originalTarget.closest("input[type=search]") || e.originalTarget.closest("input:not([type])") || - e.originalTarget.closest("textarea") - ) { + e.originalTarget.closest("textarea")) { e.stopPropagation(); e.preventDefault(); this.openTextBoxContextMenu(e.screenX, e.screenY); } - }, true); + }); this.shortcuts = new KeyShortcuts({ window: this.doc.defaultView diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector.js index b63a73abbc11..07fa5b157beb 100644 --- a/devtools/client/inspector/inspector.js +++ b/devtools/client/inspector/inspector.js @@ -1124,7 +1124,15 @@ Inspector.prototype = { }, _onContextMenu: function (e) { + if (e.originalTarget.closest("input[type=text]") || + e.originalTarget.closest("input:not([type])") || + e.originalTarget.closest("textarea")) { + return; + } + + e.stopPropagation(); e.preventDefault(); + this._openMenu({ screenX: e.screenX, screenY: e.screenY, diff --git a/devtools/client/inspector/rules/rules.js b/devtools/client/inspector/rules/rules.js index dc345f68c67e..90d631bd58e0 100644 --- a/devtools/client/inspector/rules/rules.js +++ b/devtools/client/inspector/rules/rules.js @@ -397,6 +397,15 @@ CssRuleView.prototype = { * Context menu handler. */ _onContextMenu: function (event) { + if (event.originalTarget.closest("input[type=text]") || + event.originalTarget.closest("input:not([type])") || + event.originalTarget.closest("textarea")) { + return; + } + + event.stopPropagation(); + event.preventDefault(); + this._contextmenu.show(event); }, diff --git a/devtools/client/sourceeditor/editor.js b/devtools/client/sourceeditor/editor.js index d2709b59003d..1b677af233ab 100644 --- a/devtools/client/sourceeditor/editor.js +++ b/devtools/client/sourceeditor/editor.js @@ -356,12 +356,13 @@ Editor.prototype = { }); cm.getWrapperElement().addEventListener("contextmenu", ev => { - ev.preventDefault(); - if (!this.config.contextMenu) { return; } + ev.stopPropagation(); + ev.preventDefault(); + let popup = this.config.contextMenu; if (typeof popup == "string") { popup = doc.getElementById(this.config.contextMenu);