add window.disableMenuBarAltBehavior option (#73258)

* add window.disableMenuBarAltBehavior option

* enable alt behavior when menuBarVisibility is set to 'toggle'

* rename 'window.disableMenuBarAltBehavior' to 'window.disableCustomMenuBarAltBehavior' and change its description

* don't affect mnemonics
This commit is contained in:
Evgeny Zakharov
2019-06-15 03:16:16 +05:00
committed by SteVen Batten
parent 3509f35d98
commit 1151dab2bf
3 changed files with 23 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ const $ = DOM.$;
export interface IMenuBarOptions {
enableMnemonics?: boolean;
disableAltFocus?: boolean;
visibility?: string;
getKeybinding?: (action: IAction) => ResolvedKeybinding | undefined;
alwaysOnMnemonics?: boolean;
@@ -786,7 +787,7 @@ export class MenuBar extends Disposable {
// Clean alt key press and release
if (allModifiersReleased && modifierKeyStatus.lastKeyPressed === 'alt' && modifierKeyStatus.lastKeyReleased === 'alt') {
if (!this.awaitingAltRelease) {
if (!this.isFocused) {
if (!this.isFocused && !(this.options.disableAltFocus && this.options.visibility !== 'toggle')) {
this.mnemonicsInUse = true;
this.focusedMenu = { index: this.numMenusShown > 0 ? 0 : MenuBar.OVERFLOW_INDEX };
this.focusState = MenubarState.FOCUSED;