Change:
Issue Type: Bug the Menu Bar to be hidden +Click on one of the editor/title toolbar buttons (for example in GitLens if you Alt+Click on the Blame button it will show the recent changes rather than the blame) :bug: Observe that when you let go of the key the menu bar will toggle back on FYI, I have a PR ready to submit for this VS Code version: Code - Insiders 1.21.0-insider (, 2018-02-26T05:18:08.801Z) OS version: Windows_NT x64 10.0. <details<summarySystem Info</summary </detailsReproduces without extensions <!-- generated by issue reporter --
thanks for your PR, however let's first get the bug straigthend out. explorer. alt key, trigger context menu -notice there is "Delete Permanently" go of the all key -notice there is "Delete Permanently" still there. I just verified on windows. Is this unexpected for you? Becuase it behaves just fine for me. Or is the issue only visible for extensions? Is step 1. really needed to repro? If yes how do you hide the Menu Bar fyi
I can repro my issue on Windows/Linux - but the Menu Bar must be hidden (View -Toggle Menu Bar). Hold down and click on any of these icons (granted only the GitLens one actually has an alternate command) ! When you let go of the key it will cause the Menu Bar to be shown. As for your issue, I can't even get a context menu to show up while holding down -- well it shows for a second and disappears. And that doesn't matter if the menu bar is hidden or not.
This seems to be an issue with the alt key on windows and this feels like a duplicate of
the issue you mentioned, yes -- that is a duplicate of , but the issue I mentioned is not. There is no issue with the key not working. It it just that if you hide the menu bar (on Windows/Linux) you can use the key alone to toggle it on and off. Which is perfectly fine and as-designed. But if you attempt to on an item in a "toolbar" (see the image in my previous post), the leaks through that click (the command works fine, mind you) so that not only does the command run, but the menu bar toggles (and it drives me NUTS ). There was similar work done to stop this from happening when +clicking in the editor here:
Ok thanks for more info. fyi
This issue has been closed automatically because it needs more information and has not had recent activity. See also our guidelines. Happy Coding!

Discussion:
private _subscriptions: IDisposable[] = []; private _isPressed: boolean; private static instance: AlternativeKeyEmitter; <ins> private _suppressAltKeyUp: boolean = false; </ins> private constructor(contextMenuService: IContextMenuService) { super();

this._subscriptions.push(domEvent(document.body, 'keydown')(e => { this.isPressed = e.altKey || ((isWindows || isLinux) && e.shiftKey); })); <del> this._subscriptions.push(domEvent(document.body, 'keyup')(e => this.isPressed = false)); </del> <ins> this._subscriptions.push(domEvent(document.body, 'keyup')(e => { if (this.isPressed) { if (this._suppressAltKeyUp) { e.preventDefault(); } } this._suppressAltKeyUp = false; this.isPressed = false; })); </ins> this._subscriptions.push(domEvent(document.body, 'mouseleave')(e => this.isPressed = false)); this._subscriptions.push(domEvent(document.body, 'blur')(e => this.isPressed = false)); // Workaround since we do not get any events while a context menu is shown

this.fire(this._isPressed); } <ins> suppressAltKeyUp() { this._suppressAltKeyUp = true; } </ins> static getInstance(contextMenuService: IContextMenuService) { if (!AlternativeKeyEmitter.instance) { AlternativeKeyEmitter.instance = new AlternativeKeyEmitter(contextMenuService);

event.preventDefault(); event.stopPropagation(); <ins> const altKey = AlternativeKeyEmitter.getInstance(this._contextMenuService); if (altKey.isPressed) { altKey.suppressAltKeyUp(); } </ins> this.actionRunner.run(this._commandAction) .done(undefined, err => this._notificationService.error(err)); }