Skip to content

Commit

Permalink
fix(menu): allow ssr to work properly with hardware back button updat…
Browse files Browse the repository at this point in the history
…es (#20629)
  • Loading branch information
liamdebeasi committed Feb 26, 2020
1 parent 11d8c14 commit fe8d74d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions core/src/utils/menu-controller/index.ts
Expand Up @@ -207,15 +207,17 @@ const createMenuController = () => {
registerAnimation('push', menuPushAnimation);
registerAnimation('overlay', menuOverlayAnimation);

const doc: Document = document;
doc.addEventListener('ionBackButton', (ev: any) => {
const openMenu = _getOpenSync();
if (openMenu) {
(ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => {
return openMenu.close();
});
}
});
/* tslint:disable-next-line */
if (typeof document !== 'undefined') {
document.addEventListener('ionBackButton', (ev: any) => {
const openMenu = _getOpenSync();
if (openMenu) {
(ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => {
return openMenu.close();
});
}
});
}

return {
registerAnimation,
Expand Down

0 comments on commit fe8d74d

Please sign in to comment.