Commit 63ebc35c authored by Junyi Xiao's avatar Junyi Xiao Committed by Commit Bot

Devtools: focus to tab when select from dropdown

Issue: Default focus is not seen when select a tab from dropdown menu
Fix: focus to the tab view after select a tab from dropdown


Bug: 1004171
Change-Id: If63e10d7b3cadcc50fb69fa7f775f478aa258987
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1807703Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Junyi Xiao <juxiao@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#699069}
parent 33f43ced
...@@ -308,9 +308,10 @@ UI.TabbedPane = class extends UI.VBox { ...@@ -308,9 +308,10 @@ UI.TabbedPane = class extends UI.VBox {
/** /**
* @param {string} id * @param {string} id
* @param {boolean=} userGesture * @param {boolean=} userGesture
* @param {boolean=} forceFocus
* @return {boolean} * @return {boolean}
*/ */
selectTab(id, userGesture) { selectTab(id, userGesture, forceFocus) {
if (this._currentTabLocked) if (this._currentTabLocked)
return false; return false;
const focused = this._viewHasFocus(); const focused = this._viewHasFocus();
...@@ -330,7 +331,7 @@ UI.TabbedPane = class extends UI.VBox { ...@@ -330,7 +331,7 @@ UI.TabbedPane = class extends UI.VBox {
this._tabsHistory.splice(0, 0, tab); this._tabsHistory.splice(0, 0, tab);
this._updateTabElements(); this._updateTabElements();
if (focused) if (focused || forceFocus)
this.focus(); this.focus();
const eventData = {tabId: id, view: tab.view, isUserGesture: userGesture}; const eventData = {tabId: id, view: tab.view, isUserGesture: userGesture};
...@@ -603,7 +604,7 @@ UI.TabbedPane = class extends UI.VBox { ...@@ -603,7 +604,7 @@ UI.TabbedPane = class extends UI.VBox {
*/ */
_dropDownMenuItemSelected(tab) { _dropDownMenuItemSelected(tab) {
this._lastSelectedOverflowTab = tab; this._lastSelectedOverflowTab = tab;
this.selectTab(tab.id, true); this.selectTab(tab.id, true, true);
} }
_totalWidth() { _totalWidth() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment