You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Ionic 4.0.0, beta 8] Menu not working with 2 <ion-split-pane>'s #15538
Describe the Bug
If you have an ion-split-pane tabbed PWA and place another ion-split-pane on a tab, the Menu and the main ion-split-pane are messed up.
Steps to Reproduce
Steps to reproduce the behavior:
Create a tabs project from the iconic v4 templates
Place a ion-split-pane with menu on app.component.html
Place a ion-split-pane on any tab.
Resize the browser and the menu is messed up.
Expected Behavior
Resizing the browser should have the menu disappear and reappear appropriately.
The LEFT menu appears to behave better most of the time while a RIGHT menu on the second splitpane is messed up. This bug report covers that issue #15779
Thanks for checking, but we not changed anything related to it and at the moment it has not the highest priority. But if you could take a look and maybe create a PR, that would be awesome :)
@JoeBoxr we are well aware of this issue, but it requires a lot of work and refactorization to make it work. We will handle this issue after 4.0 final is released! Thanks for your time!
Thanks @manucorporat -- This would be a great piece of functionality. Right now having a lot of trouble getting a conditionally rendered side-pane or menu to work "smoothly". I'd be happy to test this once it's supported ;)
I'm currently using an ngIf/else with ng-template to switch from a single menu split pane to a dual menu split pane depending on the current page. My workaround works but not without a full page flicker and too much code in the html template.
First I tried nested split panes, one in appComponent and one on a routeable component, creating a huge mess I couldn't fix.
Next, I tried adding my second menu to the split pane in appComponent with <ion-menu ... ngIf="currentPath.includes('exhibitorsearch/')"> where current path was a string set by an EventEmitter. This both works and doesn't work. The menu is always there on the right page, but sometimes it's hidden (swipe works) and sometimes it shows, but it should always show on a large screen. If the app was only mobile I wouldn't have an issue with the hidden menu.
I found a temporary solution that works much better. It allows an always active menu and a dynamic secondary menu that only shows when you want it to using only a single split pane. Both menus work on desktop and mobile and appear/behave how they should.
The catch is the menus need to be contained directly within the split pane (not in child components) but the menu content can be within a component. Also, using an *ngIf on the secondary menu that should show only sometimes will not work on it's own. The sub-content of the optional menu needs to re-render in order for the split pane to "register" and display the optional menu correctly (otherwise on desktop or tablets it only shows sometimes and is hidden other times).
<ion-app>
<ion-split-pane contentId="mainAppContent">
<!-- this menu always shows on the left -->
<ion-menu side="start" contentId="mainAppContent" menuId="mainMenuOutlet">
<main-menu-content></main-menu-content>
</ion-menu>
<!-- this menu only appears when the enableFilterMenu$ observable is true -->
<ion-menu [disabled]="!(searchService.enableFilterMenu$ | async)" side="end" contentId="mainAppContent" menuId="searchMenu">
<app-search-menu *ngIf="searchService.enableFilterMenu$ | async"></app-search-menu>
</ion-menu>
<ion-router-outlet id="mainAppContent"></ion-router-outlet>
</ion-split-pane>
</ion-app>
Using both the [disabled] property on the menu, with the *ngIf on the inner content is what did the trick. My observable is set in the App Component instead of child components to prevent a "Expression has changed after it was checked.". I'm deciding when to show the menu based on the current route.
Thanks for the issue. This has been resolved via #28370, and a fix will be available in an upcoming release of Ionic Framework. Please feel free to keep testing the dev build, and let me know if you run into any problems.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
GuilhermeBCC commentedon Sep 10, 2018
duplicate #15527
brandyscarney commentedon Nov 29, 2018
Thanks for the issue! Are you still seeing this problem in latest,
4.0.0-beta.16? It seems to have been resolved on the linked duplicate issue. 🙂JoeBoxr commentedon Nov 29, 2018
Yes this still exists in beta.16... let me know if you need me to create a test project for you.
JoeBoxr commentedon Nov 29, 2018
The LEFT menu appears to behave better most of the time while a RIGHT menu on the second splitpane is messed up. This bug report covers that issue #15779
paulstelzer commentedon Dec 13, 2018
It would be great if you could make a repo so we can take a look at it :) WOuld be the best if you could show issue #15779 inside, too :)
14 remaining items
paulstelzer commentedon Jan 11, 2019
Thanks for checking, but we not changed anything related to it and at the moment it has not the highest priority. But if you could take a look and maybe create a PR, that would be awesome :)
manucorporat commentedon Jan 11, 2019
@JoeBoxr we are well aware of this issue, but it requires a lot of work and refactorization to make it work. We will handle this issue after 4.0 final is released! Thanks for your time!
lincolnthree commentedon Feb 5, 2019
Thanks @manucorporat -- This would be a great piece of functionality. Right now having a lot of trouble getting a conditionally rendered side-pane or menu to work "smoothly". I'd be happy to test this once it's supported ;)
joelmeaders commentedon Mar 29, 2019
@lincolnthree any good workarounds since February?
I'm currently using an ngIf/else with ng-template to switch from a single menu split pane to a dual menu split pane depending on the current page. My workaround works but not without a full page flicker and too much code in the html template.
First I tried nested split panes, one in appComponent and one on a routeable component, creating a huge mess I couldn't fix.
Next, I tried adding my second menu to the split pane in appComponent with <ion-menu ... ngIf="currentPath.includes('exhibitorsearch/')"> where current path was a string set by an EventEmitter. This both works and doesn't work. The menu is always there on the right page, but sometimes it's hidden (swipe works) and sometimes it shows, but it should always show on a large screen. If the app was only mobile I wouldn't have an issue with the hidden menu.
A working nested split pane would be perfect.
JoeBoxr commentedon Mar 29, 2019
Hello. No workarounds yet. We had to refactor to only use 1 split pane.
GuilhermeBCC commentedon Mar 29, 2019
You do not need to use ion-split-pane. Look for any drawer in JavaScript.
joelmeaders commentedon Apr 2, 2019
I found a temporary solution that works much better. It allows an always active menu and a dynamic secondary menu that only shows when you want it to using only a single split pane. Both menus work on desktop and mobile and appear/behave how they should.
The catch is the menus need to be contained directly within the split pane (not in child components) but the menu content can be within a component. Also, using an *ngIf on the secondary menu that should show only sometimes will not work on it's own. The sub-content of the optional menu needs to re-render in order for the split pane to "register" and display the optional menu correctly (otherwise on desktop or tablets it only shows sometimes and is hidden other times).
Using both the [disabled] property on the menu, with the *ngIf on the inner content is what did the trick. My observable is set in the App Component instead of child components to prevent a "Expression has changed after it was checked.". I'm deciding when to show the menu based on the current route.
liamdebeasi commentedon Oct 17, 2023
Hi everyone,
Here is a dev build with a proposed fix if anyone is interested in testing:
7.5.1-dev.11697568647.1ac87d08Install Example:
npm install @ionic/[email protected]fix(menu): menu no longer disappears with multiple split panes (#28370)
liamdebeasi commentedon Oct 19, 2023
Thanks for the issue. This has been resolved via #28370, and a fix will be available in an upcoming release of Ionic Framework. Please feel free to keep testing the dev build, and let me know if you run into any problems.
fix(menu): menu no longer disappears with multiple split panes (#28370)
ionitron-bot commentedon Nov 18, 2023
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.