Bug 1276607 - Activate content frame when stopping RDM to restore focus. r=bigben
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 11 Aug 2016 18:26:56 -0500
changeset 400400 e225f606ad70067ab50cff51879b59be4e98659e
parent 400399 4ad88cfd05b50399ab02a3814361c9cebacffefd
child 400401 9ba0dd5271fed0e9ec56cbb5ec4528cdb7885651
push id26138
push usergszorc@mozilla.com
push dateSat, 13 Aug 2016 03:04:36 +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