Bug 1663153 - Fix Quick Filter bar not continuing to gloda search when no results are found. r=mkmelin a=wsmwk
authorAlessandro Castellani <alessandro@thunderbird.net>
Thu, 26 Nov 2020 11:46:51 +0200
changeset 40460 60d2d60d17eb3ebc6a9ac320f05d557404789783
parent 40459 6045fb572011e00d2b89e6421c7e07822bd89b94
child 40461 a9022399e43787fecfb94968849bc6048ef3dfbc
push id2871
push userjustdave@thunderbird.net
push dateThu, 03 Dec 2020 04:59:01 +0000
treeherdercomm-beta@a9022399e437 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, wsmwk
bugs1663153
Bug 1663153 - Fix Quick Filter bar not continuing to gloda search when no results are found. r=mkmelin a=wsmwk
mail/base/modules/QuickFilterManager.jsm
--- a/mail/base/modules/QuickFilterManager.jsm
+++ b/mail/base/modules/QuickFilterManager.jsm
@@ -1147,17 +1147,17 @@ var MessageTextFilter = {
 
     // -- Blurring kills upsell.
     aNode.addEventListener(
       "blur",
       function(aEvent) {
         let panel = aDocument.getElementById("qfb-text-search-upsell");
         if (
           (Services.focus.activeWindow != aDocument.defaultView ||
-            aDocument.commandDispatcher.focusedElement != aNode) &&
+            aDocument.commandDispatcher.focusedElement != aNode.inputField) &&
           panel.state == "open"
         ) {
           panel.hidePopup();
         }
       },
       true
     );
 
@@ -1193,64 +1193,69 @@ var MessageTextFilter = {
 
     aState.text = text;
     aDocument.getElementById("quick-filter-bar-filter-text-bar").collapsed =
       text == null;
     return [aState, true];
   },
 
   reflectInDOM(aNode, aFilterValue, aDocument, aMuxer, aFromPFP) {
+    let panel = aDocument.getElementById("qfb-text-search-upsell");
+
     if (aFromPFP == "nosale") {
-      let panel = aDocument.getElementById("qfb-text-search-upsell");
       if (panel.state != "closed") {
         panel.hidePopup();
       }
       return;
     }
+
     if (aFromPFP == "upsell") {
-      let panel = aDocument.getElementById("qfb-text-search-upsell");
       let line1 = aDocument.getElementById("qfb-upsell-line-one");
       let line2 = aDocument.getElementById("qfb-upsell-line-two");
       line1.value = line1.getAttribute("fmt").replace("#1", aFilterValue.text);
       line2.value = line2.getAttribute("fmt").replace("#1", aFilterValue.text);
 
       if (
         panel.state == "closed" &&
-        aDocument.commandDispatcher.focusedElement == aNode
+        aDocument.commandDispatcher.focusedElement == aNode.inputField
       ) {
-        let filterBar = aDocument.getElementById("quick-filter-bar");
-        // panel.sizeTo(filterBar.clientWidth - 20, filterBar.clientHeight - 20);
-        panel.openPopup(filterBar, "after_end", -7, 7, false, true);
+        panel.openPopup(
+          aDocument.getElementById("quick-filter-bar"),
+          "after_end",
+          -7,
+          7,
+          false,
+          true
+        );
       }
       return;
     }
 
     // Make sure we have no visible upsell on state change while our textbox
-    //  retains focus.
-    let panel = aDocument.getElementById("qfb-text-search-upsell");
+    // retains focus.
     if (panel.state != "closed") {
       panel.hidePopup();
     }
 
     // Update the text if it has changed (linux does weird things with empty
-    //  text if we're transitioning emptytext to emptytext)
+    // text if we're transitioning emptytext to emptytext).
     let desiredValue = aFilterValue.text || "";
     if (aNode.value != desiredValue) {
       aNode.value = desiredValue;
     }
 
-    // Update our expando buttons
+    // Update our expanded filters buttons.
     let states = aFilterValue.states;
     for (let name in this.textFilterDefs) {
       let textFilter = this.textFilterDefs[name];
       aDocument.getElementById(textFilter.domId).checked =
         states[textFilter.name];
     }
 
-    // Show the expando?
+    // Toggle the expanded filters visibility.
     aDocument.getElementById("quick-filter-bar-filter-text-bar").collapsed =
       aFilterValue.text == null;
   },
 
   /**
    * In order to do our upsell we need to know when we are not getting any
    *  results.
    */