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

Commit

Permalink
Stop hamburger menu from reopening
Browse files Browse the repository at this point in the history
Considering the context menus disappear on the mousedown event
I added hamburgerMenuWasOpen to the windowState to be able to
check it when the hamburgerMenu's onClick is executed

Closes #4921
  • Loading branch information
Hapcy authored and bsclifton committed Jan 25, 2017
1 parent b5999fd commit 3a9da72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,8 @@ function onHamburgerMenu (location, e) {
windowActions.setContextMenuDetail(Immutable.fromJS({
right: 0,
top: rect.bottom,
template: menuTemplate
template: menuTemplate,
type: 'hamburgerMenu'
}))
}

Expand Down
10 changes: 9 additions & 1 deletion js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,11 @@ const doAction = (action) => {
case windowConstants.WINDOW_AUTOFILL_POPUP_HIDDEN:
case windowConstants.WINDOW_SET_CONTEXT_MENU_DETAIL:
if (!action.detail) {
if (windowState.getIn(['contextMenuDetail', 'type']) === 'hamburgerMenu') {
windowState = windowState.set('hamburgerMenuWasOpen', true)
} else {
windowState = windowState.set('hamburgerMenuWasOpen', false)
}
windowState = windowState.delete('contextMenuDetail')

if (windowState.getIn(['contextMenuDetail', 'type']) === 'autofill' &&
Expand All @@ -482,7 +487,10 @@ const doAction = (action) => {
}
}
} else {
windowState = windowState.set('contextMenuDetail', action.detail)
if (!(action.detail.get('type') === 'hamburgerMenu' && windowState.get('hamburgerMenuWasOpen'))) {
windowState = windowState.set('contextMenuDetail', action.detail)
}
windowState = windowState.set('hamburgerMenuWasOpen', false)
}
break
case windowConstants.WINDOW_SET_POPUP_WINDOW_DETAIL:
Expand Down

0 comments on commit 3a9da72

Please sign in to comment.