Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Don't toggle menu unless ALT was the last key pressed #5450

Merged
merged 1 commit into from
Nov 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Main extends ImmutableComponent {
this.onFind = this.onFind.bind(this)
this.onFindHide = this.onFindHide.bind(this)
this.checkForTitleMode = debounce(this.checkForTitleMode.bind(this), 20)
this.lastKeyPressed = undefined
}
registerWindowLevelShortcuts () {
// For window level shortcuts that don't work as local shortcuts
Expand All @@ -129,6 +130,8 @@ class Main extends ImmutableComponent {
}
break
}

this.lastKeyPressed = e.which
})
}

Expand All @@ -143,16 +146,20 @@ class Main extends ImmutableComponent {
break
}

e.preventDefault()
// Only show/hide the menu if last key pressed was ALT
// (typing ALT codes should not toggle menu)
if (this.lastKeyPressed === keyCodes.ALT) {
e.preventDefault()

if (getSetting(settings.AUTO_HIDE_MENU)) {
windowActions.toggleMenubarVisible(null)
} else {
if (customTitlebar.menubarSelectedIndex) {
windowActions.setSubmenuSelectedIndex()
windowActions.setContextMenuDetail()
if (getSetting(settings.AUTO_HIDE_MENU)) {
windowActions.toggleMenubarVisible(null)
} else {
windowActions.setSubmenuSelectedIndex([0])
if (customTitlebar.menubarSelectedIndex) {
windowActions.setSubmenuSelectedIndex()
windowActions.setContextMenuDetail()
} else {
windowActions.setSubmenuSelectedIndex([0])
}
}
}
break
Expand Down