Skip to content

Commit 0eac052

Browse files
authored
Bugfix on preselected options in code action widget (microsoft#157694)
* blocking hover on code action widget startup * added fix on accidental hover - code action widget
1 parent a7f9339 commit 0eac052

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
167167
private currSelectedItem: number | undefined;
168168
private hasSeparator: boolean = false;
169169
private block?: HTMLElement;
170+
private pointerBlock?: HTMLElement;
170171

171172
public static readonly documentationID: string = '_documentation';
172173

@@ -283,6 +284,21 @@ export class CodeActionMenu extends Disposable implements IEditorContribution {
283284
}, [this.listRenderer], { keyboardSupport: false }
284285
);
285286

287+
const pointerBlockDiv = document.createElement('div');
288+
this.pointerBlock = element.appendChild(pointerBlockDiv);
289+
this.pointerBlock.classList.add('context-view-pointerBlock');
290+
this.pointerBlock.style.position = 'fixed';
291+
this.pointerBlock.style.cursor = 'initial';
292+
this.pointerBlock.style.left = '0';
293+
this.pointerBlock.style.top = '0';
294+
this.pointerBlock.style.width = '100%';
295+
this.pointerBlock.style.height = '100%';
296+
this.pointerBlock.style.zIndex = '2';
297+
298+
// Removes block on click INSIDE widget or ANY mouse movement
299+
renderDisposables.add(dom.addDisposableListener(this.pointerBlock, dom.EventType.POINTER_MOVE, () => this.pointerBlock?.remove()));
300+
renderDisposables.add(dom.addDisposableListener(this.pointerBlock, dom.EventType.MOUSE_DOWN, () => this.pointerBlock?.remove()));
301+
286302
renderDisposables.add(this.codeActionList.value.onMouseClick(e => this._onListClick(e)));
287303
renderDisposables.add(this.codeActionList.value.onMouseOver(e => this._onListHover(e)));
288304
renderDisposables.add(this.codeActionList.value.onDidChangeFocus(e => this.codeActionList.value?.domFocus()));

src/vs/editor/contrib/codeAction/browser/media/action.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
z-index: 5; /* make sure we are on top of the tree items */
3131
content: "";
3232
pointer-events: none; /* enable click through */
33-
outline: 0px solid; /* we still need to handle the empty tree or no focus item case */
34-
outline-width: 0px;
33+
outline: 0px solid !important; /* we still need to handle the empty tree or no focus item case */
34+
outline-width: 0px !important;
3535
outline-style: none;
3636
outline-offset: 0px;
3737
}

0 commit comments

Comments
 (0)