@@ -16,9 +16,10 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
1616import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
1717import { IThemeService } from 'vs/platform/theme/common/themeService' ;
1818import { IContextMenuDelegate } from 'vs/base/browser/contextmenu' ;
19- import { addDisposableListener , EventType , $ } from 'vs/base/browser/dom' ;
19+ import { addDisposableListener , EventType , $ , removeNode } from 'vs/base/browser/dom' ;
2020import { attachMenuStyler } from 'vs/platform/theme/common/styler' ;
2121import { domEvent } from 'vs/base/browser/event' ;
22+ import { ILayoutService } from 'vs/platform/layout/browser/layoutService' ;
2223
2324export class ContextMenuHandler {
2425 private element : HTMLElement | null ;
@@ -28,14 +29,14 @@ export class ContextMenuHandler {
2829 private block : HTMLElement | null ;
2930
3031 constructor (
31- element : HTMLElement | null ,
32+ private layoutService : ILayoutService ,
3233 private contextViewService : IContextViewService ,
3334 private telemetryService : ITelemetryService ,
3435 private notificationService : INotificationService ,
3536 private keybindingService : IKeybindingService ,
3637 private themeService : IThemeService
3738 ) {
38- this . setContainer ( element ) ;
39+ this . setContainer ( this . layoutService . container ) ;
3940 }
4041
4142 setContainer ( container : HTMLElement | null ) : void {
@@ -75,7 +76,9 @@ export class ContextMenuHandler {
7576 }
7677
7778 // Render invisible div to block mouse interaction in the rest of the UI
78- this . block = container . appendChild ( $ ( '.context-view-block' ) ) ;
79+ if ( this . layoutService . hasWorkbench ) {
80+ this . block = container . appendChild ( $ ( '.context-view-block' ) ) ;
81+ }
7982
8083 const menuDisposables : IDisposable [ ] = [ ] ;
8184
@@ -110,7 +113,7 @@ export class ContextMenuHandler {
110113 }
111114
112115 if ( this . block ) {
113- this . block . remove ( ) ;
116+ removeNode ( this . block ) ;
114117 this . block = null ;
115118 }
116119
0 commit comments