Bug 1053898 - Update inspector to prevent context-menu on slotted elements;r=bgrins draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 07 Mar 2018 10:36:28 +0100
changeset 773678 426fa586e9fa6212c7f9283946d3242b2296543f
parent 773677 e01c7931e66fcecbeb14f8de9901add062df6b98
child 773679 94169ef21ae54a1330ef9d41c01937b49cb912f2
child 774748 d6723178568df5ebb736292851622e1e345ec365
push id104269
push userjdescottes@mozilla.com
push dateWed, 28 Mar 2018 08:16:27 +0000
reviewersbgrins
bugs1053898
milestone61.0a1
Bug 1053898 - Update inspector to prevent context-menu on slotted elements;r=bgrins MozReview-Commit-ID: loWAiRBT18
devtools/client/inspector/inspector.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -1366,16 +1366,21 @@ Inspector.prototype = {
     this._openMenu({
       screenX: e.screenX,
       screenY: e.screenY,
       target: e.target,
     });
   },
 
   _openMenu: function({ target, screenX = 0, screenY = 0 } = { }) {
+    if (this.selection.isSlotted()) {
+      // Slotted elements should not show any context menu.
+      return null;
+    }
+
     let markupContainer = this.markup.getContainer(this.selection.nodeFront);
 
     this.contextMenuTarget = target;
     this.nodeMenuTriggerInfo = markupContainer &&
       markupContainer.editor.getInfoAtNode(target);
 
     let isSelectionElement = this.selection.isElementNode() &&
                              !this.selection.isPseudoElementNode();