Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/View.js

Issue 2377193004: [DevTools] Rework some focus code. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/ui/View.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/View.js b/third_party/WebKit/Source/devtools/front_end/ui/View.js
index 6e910f7bb55c043878ffd0a7108bc4ccd0c9f955..3171847d2054d09f024b93ed72e402883b0ef5c5 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/View.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/View.js
@@ -435,6 +435,8 @@ WebInspector.ViewManager._ContainerWidget = function(view)
WebInspector.VBox.call(this);
this.element.classList.add("flex-auto", "view-container", "overflow-auto");
this._view = view;
+ this.element.tabIndex = 0;
+ this.setDefaultFocusedElement(this.element);
}
WebInspector.ViewManager._ContainerWidget.prototype = {
@@ -447,7 +449,13 @@ WebInspector.ViewManager._ContainerWidget.prototype = {
return this._materializePromise;
var promises = [];
promises.push(this._view.toolbarItems().then(WebInspector.ViewManager._populateToolbar.bind(WebInspector.ViewManager, this.element)));
- promises.push(this._view.widget().then(widget => widget.show(this.element)));
+ promises.push(this._view.widget().then(widget => {
+ var shouldFocus = this.element.hasFocus();
+ this.setDefaultFocusedElement(null);
+ widget.show(this.element);
+ if (shouldFocus)
+ widget.focus();
+ }));
luoe 2016/09/30 18:25:36 Can we separate out this function? promises.push(
dgozman 2016/09/30 20:27:19 Good question. I feel like we are steering towards
this._materializePromise = Promise.all(promises);
return this._materializePromise;
},
@@ -696,8 +704,8 @@ WebInspector.ViewManager._TabbedLocation.prototype = {
showView: function(view, insertBefore)
{
this.appendView(view, insertBefore);
- this._tabbedPane.focus();
this._tabbedPane.selectTab(view.viewId());
+ this._tabbedPane.focus();
return this._materializeWidget(view);
},

Powered by Google App Engine
This is Rietveld 408576698