diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index 656e7409d3..832dc57b6b 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -1578,12 +1578,15 @@ params.creatorTypeID = creatorTypeID; } - // Return - t.addEventListener('keydown', (event) => { - if (event.key == 'Enter') { - this.handleCreatorAutoCompleteSelect(t, true); - } - }); + // Return/click + // Monkey-patching onTextEntered is apparently the current official way to detect completion -- + // there's also a custom event called textEntered, but it won't be fired unless the input has its + // 'notifylegacyevents' attribute set to true + // https://searchfox.org/mozilla-central/source/toolkit/content/widgets/autocomplete-input.js#372 + // https://searchfox.org/mozilla-central/rev/2d678a843ceab81e43f7ffb83212197dc10e944a/browser/components/search/content/searchbar.js#791 + t.onTextEntered = () => { + this.handleCreatorAutoCompleteSelect(t, true); + }; // Tab/Shift-Tab t.addEventListener('change', () => { this.handleCreatorAutoCompleteSelect(t, true);