From 38764efb5a9b019f6f3a451347bd7455fe4af94f Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 9 Jul 2024 10:31:35 -0400 Subject: [PATCH] editable-text: Allow autocomplete with wrapping --- chrome/content/zotero/elements/editableText.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/elements/editableText.js b/chrome/content/zotero/elements/editableText.js index 57f7ac8110..ca7122a04f 100644 --- a/chrome/content/zotero/elements/editableText.js +++ b/chrome/content/zotero/elements/editableText.js @@ -194,17 +194,17 @@ let autocompleteParams = this.autocomplete; let autocompleteEnabled = !this.multiline && !!autocompleteParams; if (!this._input - || (this._input.constructor.name === 'AutocompleteInput') !== autocompleteEnabled + || (this._input.hasAttribute('autocomplete')) !== autocompleteEnabled || this._input.tagName !== (this.noWrap ? 'input' : 'textarea')) { let input; + let inputTagName = this.noWrap ? 'input' : 'textarea'; if (autocompleteEnabled) { - input = document.createElement('input', { is: 'autocomplete-input' }); - input.type = 'autocomplete'; + input = document.createElement(inputTagName, { is: `autocomplete-${inputTagName}` }); } else { - input = this.noWrap ? document.createElement('input') : document.createElement('textarea'); - input.rows = 1; + input = document.createElement(inputTagName); } + input.rows = 1; input.classList.add('input'); input.toggleAttribute("no-windows-native", true); input.addEventListener('input', this._handleInput);