Bug 1565923 - Fix erratic behaviour when clicking results on the glodacomplete-rich-result-popup. r=mkmelin
authorAlessandro Castellani <alessandro@thunderbird.net>
Thu, 19 Dec 2019 07:36:43 +0200
changeset 37777 cd095c8109ff59e6e0701c855a376b845aa076ea
parent 37776 94ea4b034b4d69dbadecec5041e7351a75041f28
child 37778 992dc71f9c70efb2832ec3e461248bf70aa00289
push id397
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:16:13 +0000
reviewersmkmelin
bugs1565923
Bug 1565923 - Fix erratic behaviour when clicking results on the glodacomplete-rich-result-popup. r=mkmelin
mail/base/content/gloda-autocomplete-input.js
--- a/mail/base/content/gloda-autocomplete-input.js
+++ b/mail/base/content/gloda-autocomplete-input.js
@@ -49,17 +49,22 @@ customElements.whenDefined("autocomplete
         event => {
           nsDragAndDrop.drop(event, this.searchInputDNDObserver);
         },
         true
       );
 
       this.addEventListener("keypress", event => {
         if (event.keyCode == KeyEvent.DOM_VK_RETURN) {
-          this.doSearch();
+          // Trigger the click event if a popup result is currently selected.
+          if (this.popup.richlistbox.selectedIndex != -1) {
+            this.popup.onPopupClick(event);
+          } else {
+            this.doSearch();
+          }
           event.preventDefault();
           event.stopPropagation();
         }
 
         if (event.keyCode == KeyEvent.DOM_VK_ESCAPE) {
           this.clearSearch();
           event.preventDefault();
           event.stopPropagation();