@@ -146,6 +146,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
146
146
private focusedEnabledItem : number | undefined ;
147
147
private currSelectedItem : number = 0 ;
148
148
private hasSeperator : boolean = false ;
149
+ private block : HTMLElement | null = null ;
149
150
150
151
public static readonly ID : string = 'editor.contrib.codeActionMenu' ;
151
152
@@ -203,6 +204,21 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
203
204
const renderDisposables = new DisposableStore ( ) ;
204
205
const renderMenu = document . createElement ( 'div' ) ;
205
206
207
+ // Render invisible div to block mouse interaction in the rest of the UI
208
+ const menuBlock = document . createElement ( 'div' ) ;
209
+ this . block = element . appendChild ( menuBlock ) ;
210
+ this . block . classList . add ( 'context-view-block' ) ;
211
+ this . block . style . position = 'fixed' ;
212
+ this . block . style . cursor = 'initial' ;
213
+ this . block . style . left = '0' ;
214
+ this . block . style . top = '0' ;
215
+ this . block . style . width = '100%' ;
216
+ this . block . style . height = '100%' ;
217
+ this . block . style . zIndex = '-1' ;
218
+
219
+ // TODO@Steven : this is never getting disposed
220
+ dom . addDisposableListener ( this . block , dom . EventType . MOUSE_DOWN , e => e . stopPropagation ( ) ) ;
221
+
206
222
renderMenu . id = 'codeActionMenuWidget' ;
207
223
renderMenu . classList . add ( 'codeActionMenuWidget' ) ;
208
224
@@ -267,9 +283,19 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
267
283
this . currSelectedItem = this . viewItems [ 0 ] . index ;
268
284
this . codeActionList . value . setFocus ( [ this . currSelectedItem ] ) ;
269
285
286
+
287
+ // const focusTracker = this._register(dom.trackFocus(element));
288
+ // this._register(focusTracker.onDidBlur(() => {
289
+ // if (dom.getActiveElement() === element || !dom.isAncestor(dom.getActiveElement(), element)) {
290
+ // this.hideCodeActionWidget();
291
+ // }
292
+ // }));
293
+
270
294
// List Focus
271
295
this . codeActionList . value . domFocus ( ) ;
272
296
const focusTracker = dom . trackFocus ( element ) ;
297
+
298
+ element . focus ( ) ;
273
299
const blurListener = focusTracker . onDidBlur ( ( ) => {
274
300
this . hideCodeActionWidget ( ) ;
275
301
// this._contextViewService.hideContextView({ source: this });
0 commit comments