Change:
click to open context menu in text editor +P to open quick open :bug: both context menu and quick open are dismissed !
re: context menu
This is not a regression so assigning to december
I'm going to pass to you for your take. Here's what I found out. When we show the command palette that causes the editor context menu to trigger the hide: This hide, focuses the editor... but in doing so, that causes the Quick Pick's didBlur to hide: which will hide the quick pick if is set to which is the default. This behavior with context menus seems to repro: Always in context menus of the editor Only with custom menus (not native menus) in the rest of the product (tree views, Account/Gear menu, etc)
Two actions here: needs to be removed or handled better (passing that to or menus should follow the logic: if ESC/selection, focus what was previously focused. If dismissed due to focus lost, don't restore focus (this goes to
my suspicion is that the editor contribution is old and unnecessary as the behavior is built-in to the menu widget. Removing it, we can centralize the logic to the menu widget.
re-opening as we still have some work to do on the custom menu side

Discussion:
*--------------------------------------------------------------------------------------------*/ import { IContextMenuDelegate } from 'vs/base/browser/contextmenu'; <del> import { $, addDisposableListener, EventType, isHTMLElement } from 'vs/base/browser/dom'; </del> <ins> import { $, addDisposableListener, EventType, getActiveElement, isAncestor, isHTMLElement } from 'vs/base/browser/dom'; </ins> import { StandardMouseEvent } from 'vs/base/browser/mouseEvent'; import { Menu } from 'vs/base/browser/ui/menu/menu'; import { ActionRunner, IRunEvent, WorkbenchActionExecutedClassification, WorkbenchActionExecutedEvent } from 'vs/base/common/actions'; import { isCancellationError } from 'vs/base/common/errors'; <del> import { combinedDisposable, DisposableStore } from 'vs/base/common/lifecycle'; </del> <ins> import { combinedDisposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; </ins> import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { INotificationService } from 'vs/platform/notification/common/notification';

export class ContextMenuHandler { private focusToReturn: HTMLElement | null = null; <ins> private lastContainer: HTMLElement | null = null; </ins> private block: HTMLElement | null = null; <ins> private blockDisposable: IDisposable | null = null; </ins> private options: IContextMenuHandlerOptions = { blockMouse: true }; constructor(

anchorAxisAlignment: delegate.anchorAxisAlignment, render: (container) => { <ins> this.lastContainer = container; </ins> const className = delegate.getMenuClassName ? delegate.getMenuClassName() : ''; if (className) {

this.block.style.height = '100%'; this.block.style.zIndex = '-1'; <del> // TODO@Steven: this is never getting disposed addDisposableListener(this.block, EventType.MOUSE_DOWN, e => e.stopPropagation()); </del> <ins> this.blockDisposable?.dispose(); this.blockDisposable = addDisposableListener(this.block, EventType.MOUSE_DOWN, e => e.stopPropagation()); </ins> } const menuDisposables = new DisposableStore();

this.block = null; } <del> this.focusToReturn?.focus(); </del> <ins> this.blockDisposable?.dispose(); if (!!this.lastContainer && (getActiveElement() === this.lastContainer || isAncestor(getActiveElement(), this.lastContainer))) { this.focusToReturn?.focus(); } this.lastContainer = null; </ins> } }, shadowRootElement, !!shadowRootElement); }

this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: e.action.id, from: 'contextMenu' }); this.contextViewService.hideContextView(false); <del> // Restore focus here this.focusToReturn?.focus(); </del> } private onDidActionRun(e: IRunEvent): void {

getAnchor: () => e, getActions: () => this.textInputActions, getActionsContext: () => target, <del> onHide: () => target.focus() // fixes https://github.com/microsoft/vscode/issues/52948 </del> }); } }