Bug 1276607 - Activate content frame when stopping RDM to restore focus. r=bigben draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 11 Aug 2016 18:26:56 -0500
changeset 399737 7d1cc6cf827a18fbcb6115df53a4d391308a2072
parent 399408 0502bd9e025edde29777ba1de4280f9b52af4663
child 528049 a1698c4fc8925925f74758d49e7762dd09c6dd6b
push id25970
push userbmo:jryans@gmail.com
push dateThu, 11 Aug 2016 23:27:31 +0000
reviewersbigben
bugs1276607
milestone51.0a1
Bug 1276607 - Activate content frame when stopping RDM to restore focus. r=bigben MozReview-Commit-ID: CgDxa0aaQwi
devtools/client/responsive.html/browser/swap.js
--- a/devtools/client/responsive.html/browser/swap.js
+++ b/devtools/client/responsive.html/browser/swap.js
@@ -123,16 +123,21 @@ function swapToInnerBrowser({ tab, conta
       //    into this tab.
       gBrowser.updateBrowserRemoteness(tab.linkedBrowser, true);
 
       // 6. Swap the content into the original browser tab and close the
       //    temporary tab used to hold the content via
       //    `swapBrowsersAndCloseOther`.
       gBrowser.swapBrowsersAndCloseOther(tab, contentTab);
       gBrowser = null;
+
+      // The focus manager seems to get a little dizzy after all this swapping.  If a
+      // content element had been focused inside the viewport before stopping, it will
+      // have lost focus.  Activate the frame to restore expected focus.
+      tab.linkedBrowser.frameLoader.activateRemoteFrame();
     },
 
   };
 }
 
 /**
  * Browser navigation properties we'll freeze temporarily to avoid "blinking" in the
  * location bar, etc. caused by the containerURL peeking through before the swap is