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 335326 35a4e516308e1f9edf72e0d81e8a4739b8d2cacc
parent 335325 9798772706750302d87a689cbbf056ae04244f80
child 335327 0d538c5500ce3294b44bf9ae5c5cf64ea7614fe7
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, gchang
bugs1260820
milestone48.0
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
@@ -178,17 +178,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;
       }
     }
   },