@@ -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 ;
149
150
150
151
public static readonly ID : string = 'editor.contrib.codeActionMenu' ;
151
152
@@ -203,6 +204,20 @@ 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
+ renderDisposables . add ( dom . addDisposableListener ( this . block , dom . EventType . MOUSE_DOWN , e => e . stopPropagation ( ) ) ) ;
220
+
206
221
renderMenu . id = 'codeActionMenuWidget' ;
207
222
renderMenu . classList . add ( 'codeActionMenuWidget' ) ;
208
223
@@ -263,9 +278,13 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
263
278
this . codeActionList . value ?. layout ( height , maxWidth ) ;
264
279
265
280
// List selection
266
- this . focusedEnabledItem = 0 ;
267
- this . currSelectedItem = this . viewItems [ 0 ] . index ;
268
- this . codeActionList . value . setFocus ( [ this . currSelectedItem ] ) ;
281
+ if ( this . viewItems . length < 1 ) {
282
+ this . currSelectedItem = 0 ;
283
+ } else {
284
+ this . focusedEnabledItem = 0 ;
285
+ this . currSelectedItem = this . viewItems [ 0 ] . index ;
286
+ this . codeActionList . value . setFocus ( [ this . currSelectedItem ] ) ;
287
+ }
269
288
270
289
// List Focus
271
290
this . codeActionList . value . domFocus ( ) ;
@@ -284,7 +303,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
284
303
protected focusPrevious ( ) {
285
304
if ( typeof this . focusedEnabledItem === 'undefined' ) {
286
305
this . focusedEnabledItem = this . viewItems [ 0 ] . index ;
287
- } else if ( this . viewItems . length <= 1 ) {
306
+ } else if ( this . viewItems . length < 1 ) {
288
307
return false ;
289
308
}
290
309
@@ -307,7 +326,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
307
326
protected focusNext ( ) {
308
327
if ( typeof this . focusedEnabledItem === 'undefined' ) {
309
328
this . focusedEnabledItem = this . viewItems . length - 1 ;
310
- } else if ( this . viewItems . length <= 1 ) {
329
+ } else if ( this . viewItems . length < 1 ) {
311
330
return false ;
312
331
}
313
332
0 commit comments