Skip to content

Commit

Permalink
trigger menu only on altkey up
Browse files Browse the repository at this point in the history
  • Loading branch information
sbatten committed Aug 2, 2018
1 parent 49bce6d commit 69ccf52
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/vs/workbench/browser/parts/menubar/menubarPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export class MenubarPart extends Part {
}

private onDidChangeFullscreen(): void {
this.setUnfocusedState();
this.updateStyles();
}

Expand Down Expand Up @@ -356,22 +357,12 @@ export class MenubarPart extends Part {

private onModifierKeyToggled(modifierKeyStatus: IModifierKeyStatus): void {
this._modifierKeyStatus = modifierKeyStatus;
const altKeyAlone = modifierKeyStatus.lastKeyPressed === 'alt' && !modifierKeyStatus.ctrlKey && !modifierKeyStatus.shiftKey;
const allModifiersReleased = !modifierKeyStatus.altKey && !modifierKeyStatus.ctrlKey && !modifierKeyStatus.shiftKey;

if (this.currentMenubarVisibility === 'hidden') {
return;
}

if (this.currentMenubarVisibility === 'toggle') {
if (altKeyAlone) {
if (!this.isVisible) {
this.focusState = MenubarState.VISIBLE;
}
} else if (!allModifiersReleased && !this.isFocused) {
this.focusState = MenubarState.HIDDEN;
}
}

if (allModifiersReleased && modifierKeyStatus.lastKeyPressed === 'alt' && modifierKeyStatus.lastKeyReleased === 'alt') {
if (!this.isFocused) {
Expand Down Expand Up @@ -707,7 +698,7 @@ export class MenubarPart extends Part {

this.customMenus[menuIndex].buttonElement.on(EventType.CLICK, (e) => {
// This should only happen for mnemonics and we shouldn't trigger them
if (!this.isVisible) {
if (this.currentMenubarVisibility === 'hidden') {
return;
}

Expand Down

0 comments on commit 69ccf52

Please sign in to comment.