Index: Source/devtools/front_end/ui/TabbedPane.js |
diff --git a/Source/devtools/front_end/ui/TabbedPane.js b/Source/devtools/front_end/ui/TabbedPane.js |
index 787bb7d3579afa675affd01dabc4abab5c3e84cf..80a0d0adaa421a26b21742c2ba4fc98414aa588c 100644 |
--- a/Source/devtools/front_end/ui/TabbedPane.js |
+++ b/Source/devtools/front_end/ui/TabbedPane.js |
@@ -1198,10 +1198,20 @@ WebInspector.ExtensibleTabbedPaneController.prototype = { |
*/ |
_tabSelected: function(event) |
{ |
- var tabId = this._tabbedPane.selectedTabId; |
- if (!tabId) |
- return; |
- this.viewForId(tabId).then(this._tabbedPane.changeTabView.bind(this._tabbedPane, tabId)).done(); |
+ var tabId = /** @type {string} */ (event.data.tabId); |
+ this.viewForId(tabId).then(viewLoaded.bind(this)).done(); |
+ |
+ /** |
+ * @this {WebInspector.ExtensibleTabbedPaneController} |
+ * @param {!WebInspector.View} view |
+ */ |
+ function viewLoaded(view) |
+ { |
+ var shouldFocus = this._tabbedPane.visibleView.element.isSelfOrAncestor(WebInspector.currentFocusElement()); |
+ this._tabbedPane.changeTabView(tabId, view); |
+ if (shouldFocus) |
+ view.focus(); |
+ } |
}, |
/** |