@@ -19,6 +19,7 @@ import { WebviewInput } from 'vs/workbench/contrib/webview/browser/webviewEditor
1919import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService' ;
2020import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
2121import { IHostService } from 'vs/workbench/services/host/browser/host' ;
22+ import { IWorkbenchLayoutService , Parts } from 'vs/workbench/services/layout/browser/layoutService' ;
2223
2324export class WebviewEditor extends BaseEditor {
2425
@@ -39,6 +40,8 @@ export class WebviewEditor extends BaseEditor {
3940 @IThemeService themeService : IThemeService ,
4041 @IStorageService storageService : IStorageService ,
4142 @IEditorService private readonly _editorService : IEditorService ,
43+ @IWorkbenchLayoutService private readonly _workbenchLayoutService : IWorkbenchLayoutService ,
44+ @IEditorGroupsService private readonly _editorGroupsService : IEditorGroupsService ,
4245 @IEditorDropService private readonly _editorDropService : IEditorDropService ,
4346 @IHostService private readonly _hostService : IHostService ,
4447 ) {
@@ -76,7 +79,7 @@ export class WebviewEditor extends BaseEditor {
7679 if ( ! this . _onFocusWindowHandler . value && ! isWeb ) {
7780 // Make sure we restore focus when switching back to a VS Code window
7881 this . _onFocusWindowHandler . value = this . _hostService . onDidChangeFocus ( focused => {
79- if ( focused && this . _editorService . activeEditorPane === this ) {
82+ if ( focused && this . _editorService . activeEditorPane === this && this . _workbenchLayoutService . hasFocus ( Parts . EDITOR_PART ) ) {
8083 this . focus ( ) ;
8184 }
8285 } ) ;
0 commit comments