diff --git a/devtools/client/shared/inplace-editor.js b/devtools/client/shared/inplace-editor.js index 03ce352244f3..3da3224f8bae 100644 --- a/devtools/client/shared/inplace-editor.js +++ b/devtools/client/shared/inplace-editor.js @@ -1326,7 +1326,8 @@ InplaceEditor.prototype = { if (finalList.length > 1) { // Calculate the popup horizontal offset. let indent = this.input.selectionStart - query.length; - let offset = indent * this.inputCharWidth; + let offset = indent * this.inputCharDimensions.width; + offset = this._isSingleLine() ? offset : 0; // Select the most relevantItem if autoInsert is allowed let selectedIndex = autoInsert ? mostRelevantIndex : -1; @@ -1342,6 +1343,16 @@ InplaceEditor.prototype = { this._doValidation(); }, 0); }, + + /** + * Check if the current input is displaying more than one line of text. + * + * @return {Boolean} true if the input has a single line of text + */ + _isSingleLine: function() { + let inputRect = this.input.getBoundingClientRect(); + return inputRect.height < 2 * this.inputCharDimensions.height; + }, }; /**