fix(menu): allow ssr to work properly with hardware back button updates (#20629)

This commit is contained in:
Liam DeBeasi
2020-02-26 15:54:50 -05:00
committed by GitHub
parent 11d8c14d72
commit fe8d74d08c

View File

@ -207,15 +207,17 @@ const createMenuController = () => {
registerAnimation('push', menuPushAnimation); registerAnimation('push', menuPushAnimation);
registerAnimation('overlay', menuOverlayAnimation); registerAnimation('overlay', menuOverlayAnimation);
const doc: Document = document; /* tslint:disable-next-line */
doc.addEventListener('ionBackButton', (ev: any) => { if (typeof document !== 'undefined') {
const openMenu = _getOpenSync(); document.addEventListener('ionBackButton', (ev: any) => {
if (openMenu) { const openMenu = _getOpenSync();
(ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => { if (openMenu) {
return openMenu.close(); (ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => {
}); return openMenu.close();
} });
}); }
});
}
return { return {
registerAnimation, registerAnimation,