Bug 1477525 part 2 - Try hiding toolbox again when input in chrome loses the focus. r?dao draft
authorXidorn Quan <me@upsuper.org>
Mon, 23 Jul 2018 11:10:37 +1000
changeset 821338 29e4f086058230b8ad243c6a86dca79ac650af78
parent 821337 d6a28c3be45477295d106ab7071dba34efff8e57
push id117066
push userxquan@mozilla.com
push dateMon, 23 Jul 2018 01:12:09 +0000
reviewersdao
bugs1477525
milestone63.0a1
Bug 1477525 part 2 - Try hiding toolbox again when input in chrome loses the focus. r?dao MozReview-Commit-ID: LnwVXN4oS2Z
browser/base/content/browser-fullScreenAndPointerLock.js
--- a/browser/base/content/browser-fullScreenAndPointerLock.js
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js
@@ -591,19 +591,25 @@ var FullScreen = {
       return;
     }
     // On OS X Lion we don't want to hide toolbars.
     if (this.useLionFullScreen) {
       return;
     }
 
     // a textbox in chrome is focused (location bar anyone?): don't collapse chrome
-    if (document.commandDispatcher.focusedElement &&
-        document.commandDispatcher.focusedElement.ownerDocument == document &&
-        document.commandDispatcher.focusedElement.localName == "input") {
+    let focused = document.commandDispatcher.focusedElement;
+    if (focused && focused.ownerDocument == document &&
+        focused.localName == "input") {
+      // But try collapse the chrome again when it loses the focus.
+      focused.addEventListener("blur", () => {
+        // If we don't set any timeout here, the content may move before
+        // user's click takes effect.
+        setTimeout(() => this.hideNavToolbox(aAnimate), 300);
+      }, {once: true});
       return;
     }
 
     this._fullScrToggler.hidden = false;
 
     if (aAnimate && Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
       gNavToolbox.setAttribute("fullscreenShouldAnimate", true);
       // Hide the fullscreen toggler until the transition ends.