Bug 639530 - Suggestions bubble persists on results page after filling out the search form [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Mon, 09 May 2011 13:28:48 +0200
changeset 69381 05786df6cc16eaa24013c04f22ce0704402695f2
parent 69380 807ea3a5844f7165d0930fd7cff6682ed84d6150
child 69382 b2ce3817d034874c254867f4d3e296079256fd76
push id76
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:00:57 +0000
treeherdermozilla-beta@d3a2732c35f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs639530
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 639530 - Suggestions bubble persists on results page after filling out the search form [r=mfinkle]
mobile/chrome/content/forms.js
--- a/mobile/chrome/content/forms.js
+++ b/mobile/chrome/content/forms.js
@@ -74,16 +74,17 @@ function FormAssistant() {
    */
   addEventListener("text", this, false);
 
   addEventListener("keypress", this, true);
   addEventListener("keyup", this, false);
   addEventListener("focus", this, true);
   addEventListener("pageshow", this, false);
   addEventListener("pagehide", this, false);
+  addEventListener("submit", this, false);
 
   this._enabled = Services.prefs.getBoolPref("formhelper.enabled");
 };
 
 FormAssistant.prototype = {
   _selectWrapper: null,
   _currentIndex: -1,
   _elements: [],
@@ -290,16 +291,21 @@ FormAssistant.prototype = {
     // focus changes should be taken into account only if the user has done a
     // manual operation like manually clicking
     let shouldIgnoreFocus = (aEvent.type == "focus" && !this._open && !this.focusSync);
     if ((!this._open && aEvent.type != "focus") || shouldIgnoreFocus)
       return;
 
     let currentElement = this.currentElement;
     switch (aEvent.type) {
+      case "submit":
+        // submit is a final action and the form assistant should be closed
+        this.close();
+        break;
+
       case "pagehide":
       case "pageshow":
         // When reacting to a page show/hide, if the focus is different this
         // could mean the web page has dramatically changed because of
         // an Ajax change based on fragment identifier
         if (gFocusManager.focusedElement != currentElement)
           this.close();
         break;