Bug 1169704 - In-content preferences - Search tab - "One-click search engines" table remains highlighted after clicking elsewhere on the page, r=jaws
authorFischer.json <fischer.json@gmail.com>
Tue, 26 Jul 2016 18:12:42 +0800
changeset 332162 90b49d2b01334dd107bcbea8f0790dc518344fe2
parent 332161 ad4e4ea6550a47c0034608ab9fe038eca8be44d6
child 332163 e82080019746478198c4009ba0c5c358be3f0359
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1169704
milestone50.0a1
Bug 1169704 - In-content preferences - Search tab - "One-click search engines" table remains highlighted after clicking elsewhere on the page, r=jaws MozReview-Commit-ID: 2Tbzr0wSpv1
browser/components/preferences/in-content/search.js
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -101,16 +101,28 @@ var gSearchPane = {
       if (e.name == currentEngine)
         list.selectedItem = item;
     });
   },
 
   handleEvent: function(aEvent) {
     switch (aEvent.type) {
       case "click":
+        if (aEvent.target.id != "engineChildren" && aEvent.target.id != "removeEngineButton") {
+          let engineList = document.getElementById("engineList");
+          // We don't want to toggle off selection while editing keyword
+          // so proceed only when the input field is hidden
+          if (engineList.inputField.hidden) {
+            let selection = engineList.view.selection;
+            if (selection.count > 0) {
+              selection.toggleSelect(selection.currentIndex);
+            }
+            engineList.blur();
+          }
+        }
         if (aEvent.target.id == "addEngines" && aEvent.button == 0) {
           Services.wm.getMostRecentWindow('navigator:browser')
                      .BrowserSearch.loadAddEngines();
         }
         break;
       case "command":
         switch (aEvent.target.id) {
           case "":