Change:
Issue Type: <bBug</bWhen using the custom title bar and the toggled menu bar setting, the menu bar becomes stuck in the toggled on state. This primarily occurs when the active VS Code window becomes inactive while the menu bar is toggled on. When using multiple VS Code windows this makes it difficult to identify the correct window because the title bar's filename information is hidden. Steps to reproduce: the setting to , and setting to VS Code is the active window, hold down the key to show the menu bar the key while still holding the key to switch to another application. The active VS Code window becomes inactive and the menu bar is visible. Alternatively you can click outside of the active VS Code window while the menu bar is being displayed. VS Code version: Code 1.25.0 (, 2018-07-05T13:11:58.697Z) OS version: Windows_NT x64 10.0. <details<summaryExtensions (4)</summaryExtensionVersion ------ classic-asp0.0.4 vscode-icon-theme1.6.2 csharp1.15.2 PowerShell1.8.0 </details<!-- generated by issue reporter --
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.538 --- <!-- score: 0.491 --- <!-- score: 0.483 --- <!-- score: 0.482 --- <!-- score: 0.48 --<!-- potentialduplicatescomment --

Discussion:
this.actionRunner = this._register(new ActionRunner()); this._register(this.actionRunner.onDidBeforeRun(() => { <del> this.focusState = this.currentMenubarVisibility === 'toggle' ? MenubarState.HIDDEN : MenubarState.VISIBLE; </del> <ins> this.setUnfocusedState(); </ins> })); this._onVisibilityChange = this._register(new Emitter<Dimension>());

this.container.removeClass('inactive'); } else { this.container.addClass('inactive'); <ins> this.setUnfocusedState(); </ins> } } }

} } <ins> private setUnfocusedState(): void { this.focusState = this.currentMenubarVisibility === 'toggle' ? MenubarState.HIDDEN : MenubarState.VISIBLE; } </ins> private hideMenubar(): void { this._onVisibilityChange.fire(new Dimension(0, 0)); this.container.style('visibility', 'hidden');

this.focusedMenu = { index: 0 }; this.focusState = MenubarState.FOCUSED; } else if (!this.isOpen) { <del> this.focusState = this.currentMenubarVisibility === 'toggle' ? MenubarState.HIDDEN : MenubarState.VISIBLE; </del> <ins> this.setUnfocusedState(); </ins> } }

} }); <del> this.customMenus[menuIndex].buttonElement.on(EventType.CLICK, () => { </del> <ins> this.customMenus[menuIndex].buttonElement.on(EventType.CLICK, (e) => { </ins> if (this._modifierKeyStatus && (this._modifierKeyStatus.shiftKey || this._modifierKeyStatus.ctrlKey)) { return; // supress keyboard shortcuts that shouldn't conflict } if (this.isOpen) { if (this.isCurrentMenu(menuIndex)) { <del> this.focusState = this.currentMenubarVisibility === 'toggle' ? MenubarState.HIDDEN : MenubarState.VISIBLE; </del> <ins> this.setUnfocusedState(); </ins> } else { this.cleanupCustomMenu(); this.showCustomMenu(menuIndex);

this.focusedMenu = { index: menuIndex }; this.focusState = MenubarState.OPEN; } <ins> e.preventDefault(); e.stopPropagation(); </ins> }); this.customMenus[menuIndex].buttonElement.on(EventType.MOUSE_ENTER, () => {

} else if (event.equals(KeyCode.RightArrow) || event.equals(KeyCode.Tab)) { this.focusNext(); } else if (event.equals(KeyCode.Escape) && this.isFocused && !this.isOpen) { <del> this.focusState = this.currentMenubarVisibility === 'toggle' ? MenubarState.HIDDEN : MenubarState.VISIBLE; </del> <ins> this.setUnfocusedState(); </ins> } else { eventHandled = false; }

event.stopPropagation(); } }); <ins> this._register($(window).on(EventType.CLICK, () => { // This click is outside the menubar so it counts as a focus out if (this.isFocused) { this.setUnfocusedState(); } })); </ins> } this.container.on(EventType.FOCUS_IN, (e) => {

if (event.relatedTarget) { if (!this.container.getHTMLElement().contains(event.relatedTarget as HTMLElement)) { this.focusToReturn = null; <del> this.focusState = this.currentMenubarVisibility === 'toggle' ? MenubarState.HIDDEN : MenubarState.VISIBLE; </del> <ins> this.setUnfocusedState(); </ins> } } });