Bug 820057 - Hide the keyboard on pagehide and submit events r=margaret a=blocking-basecamp
authorTim Taubert <ttaubert@mozilla.com>
Mon, 07 Jan 2013 12:09:50 +0100
changeset 123485 40b1de54022af3479292821db43ca018730f5221
parent 123484 09a4cfc709578ddd0ee7e60aeb077e37da0620f1
child 123486 e3b4a698e0362c0d3346e11602607989c4c4433d
push id3129
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 22:54:45 +0000
treeherdermozilla-aurora@090bc89ff6b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, blocking-basecamp
bugs820057
milestone20.0a1
Bug 820057 - Hide the keyboard on pagehide and submit events r=margaret a=blocking-basecamp
b2g/chrome/content/forms.js
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -178,16 +178,18 @@ let FormVisibility = {
   }
 };
 
 let FormAssistant = {
   init: function fa_init() {
     addEventListener("focus", this, true, false);
     addEventListener("blur", this, true, false);
     addEventListener("resize", this, true, false);
+    addEventListener("submit", this, true, false);
+    addEventListener("pagehide", this, true, false);
     addMessageListener("Forms:Select:Choice", this);
     addMessageListener("Forms:Input:Value", this);
     addMessageListener("Forms:Select:Blur", this);
     Services.obs.addObserver(this, "xpcom-shutdown", false);
   },
 
   ignoredInputTypes: new Set([
     'button', 'file', 'checkbox', 'radio', 'reset', 'submit', 'image'
@@ -241,16 +243,18 @@ let FormAssistant = {
           break;
         }
 
         if (target && this.isFocusableElement(target))
           this.showKeyboard(target);
         break;
 
       case "blur":
+      case "submit":
+      case "pagehide":
         if (this.focusedElement)
           this.hideKeyboard();
         break;
 
       case 'mousedown':
         // We only listen for this event on the currently focused element.
         // When the mouse goes down, note the cursor/selection position
         this.selectionStart = this.focusedElement.selectionStart;