未验证 提交 9bea23ba 编写于 作者: D David Linskey 提交者: GitHub

Fix webviews stealing focus when not last focused (#98847)

Fixes #61489
Co-authored-by: NMatt Bierner <matb@microsoft.com>
上级 b2c8b2ac
......@@ -19,6 +19,7 @@ import { WebviewInput } from 'vs/workbench/contrib/webview/browser/webviewEditor
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
export class WebviewEditor extends BaseEditor {
......@@ -39,6 +40,8 @@ export class WebviewEditor extends BaseEditor {
@IThemeService themeService: IThemeService,
@IStorageService storageService: IStorageService,
@IEditorService private readonly _editorService: IEditorService,
@IWorkbenchLayoutService private readonly _workbenchLayoutService: IWorkbenchLayoutService,
@IEditorGroupsService private readonly _editorGroupsService: IEditorGroupsService,
@IEditorDropService private readonly _editorDropService: IEditorDropService,
@IHostService private readonly _hostService: IHostService,
) {
......@@ -76,7 +79,7 @@ export class WebviewEditor extends BaseEditor {
if (!this._onFocusWindowHandler.value && !isWeb) {
// Make sure we restore focus when switching back to a VS Code window
this._onFocusWindowHandler.value = this._hostService.onDidChangeFocus(focused => {
if (focused && this._editorService.activeEditorPane === this) {
if (focused && this._editorService.activeEditorPane === this && this._workbenchLayoutService.hasFocus(Parts.EDITOR_PART)) {
this.focus();
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册