Bug 1260820 - Search engine drop down closes when I change search engines by pressing Up/Down, r=Gijs, a=gchang
authorFlorian Quèze <florian@queze.net>
Fri, 10 Jun 2016 09:55:30 +0200
changeset 341628 75033b504c4cea3f18196c53a08cfec7c0008f93
parent 341627 654fc37e64d5cb14f16da261424a6aaa38cb18a5
child 341629 541035fe27cb71fd6fdcd273c5190edd688f0731
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, gchang
bugs1260820
milestone49.0a2
Bug 1260820 - Search engine drop down closes when I change search engines by pressing Up/Down, r=Gijs, a=gchang
browser/components/preferences/in-content/search.js
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -164,17 +164,23 @@ var gSearchPane = {
       case "engine-changed":
         gEngineView._engineStore.reloadIcons();
         gEngineView.invalidate();
         break;
       case "engine-removed":
         gSearchPane.remove(aEngine);
         break;
       case "engine-current":
-        gSearchPane.buildDefaultEngineDropDown();
+        // If the user is going through the drop down using up/down keys, the
+        // dropdown may still be open (eg. on Windows) when engine-current is
+        // fired, so rebuilding the list unconditionally would get in the way.
+        let selectedEngine =
+          document.getElementById("defaultEngine").selectedItem.engine;
+        if (selectedEngine.name != aEngine.name)
+          gSearchPane.buildDefaultEngineDropDown();
         break;
       case "engine-default":
         // Not relevant
         break;
       }
     }
   },