diff --git a/browser/devtools/shared/inplace-editor.js b/browser/devtools/shared/inplace-editor.js index 45a6871e4e2..3058304b038 100644 --- a/browser/devtools/shared/inplace-editor.js +++ b/browser/devtools/shared/inplace-editor.js @@ -720,7 +720,8 @@ InplaceEditor.prototype = { _cycleCSSSuggestion: function InplaceEditor_cycleCSSSuggestion(aReverse, aNoSelect) { - let {label, preLabel} = this.popup.selectedItem; + // selectedItem can be null when nothing is selected in an empty editor. + let {label, preLabel} = this.popup.selectedItem || {label: "", preLabel: ""}; if (aReverse) { this.popup.selectPreviousItem(); } else { @@ -872,7 +873,7 @@ InplaceEditor.prototype = { if (this.popup && this.popup.isOpen) { this.popup.hidePopup(); } - } else if (!cycling) { + } else if (!cycling && !aEvent.metaKey && !aEvent.altKey && !aEvent.ctrlKey) { this._maybeSuggestCompletion(); } diff --git a/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js b/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js index fba13b8e284..f052936c707 100644 --- a/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js +++ b/browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js @@ -21,9 +21,11 @@ let brace; // total items in the popup // ] let testData = [ + ["a", {accelKey: true, ctrlKey: true}, "", -1, 0], ["d", {}, "direction", 0, 3], ["VK_DOWN", {}, "display", 1, 3], ["VK_TAB", {}, "", -1, 10], + ["VK_DOWN", {}, "-moz-box", 0, 10], ["n", {}, "none", -1, 0], ["VK_TAB", {shiftKey: true}, "display", -1, 0], ["VK_BACK_SPACE", {}, "", -1, 0], @@ -85,7 +87,8 @@ function checkStateAndMoveOn(index) { checkState(); }); } - else if (/(right|back_space|escape|return)/ig.test(key)) { + else if (/(right|back_space|escape|return)/ig.test(key) || + (modifiers.accelKey || modifiers.ctrlKey)) { info("added event listener for right|escape|back_space|return keys"); editor.input.addEventListener("keypress", function onKeypress() { if (editor.input) {