-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: navigating with multiple split panes causes first menu to never be reactivated #18683
Comments
Hi. i am using 2 split-pane, firstmenu/firstpage will be my home screen. from firstpage i am navigating to secondmenu/secondpage. now when i return back to firstmenu/firstpage, the split-pane is getting hide, can someone help me on this please. see the screenshot and code below. Members firstmenu/firstpage: |
Thanks for the issue. I think this problem stems from the fact that we only allow 1 menu to be enabled at a time. If you want these two side panes to be always be open, I would recommend wrapping them in something other than In your demo repo, I wrapped them each in a If you really need to use |
Issue happens even if only using one |
@liamdebeasi thanks for you help, its much appreciated. it works perfect when you use div.. |
When using |
@liamdebeasi are you saying we should have no more than one menu in an application or we may run into problems even if only one of them is shown at one time? |
No, but in the case of the original issue the way the multiple menus were added seemed to cause issues. We are investigating this bug and will post an update here when we have an update. Thanks! |
@yogeshshsf Any luck on this? |
@daveshirman it is working as expected when i wrap using as mentioned by @liamdebeasi comment
|
I have exactly the same problem. I want to outsource my navigation in a layout component. I hope you can help me Here the structure of the different files. I also attach a picture of the folder structure Sorry but somehow the editor does not want to highlight my code app-routing.module.ts `import { NgModule } from '@angular/core'; const routes: Routes = [ @NgModule({ ` Menu
` app.component.html
@liamdebeasi liamdebeasi is there a solution? |
I fixed this by replacing the |
If you use this method, how does your menu toggle work on smaller screens? My burger menu will not appear, so you cannot access the menu. |
@cra1gs this is how I ended up using the split-pane: <ion-split-pane when="xs" contentId="location-specifics" [disabled]="closeMenu$ | async">
<div>
<ion-content>
<ion-list>
...menu content here
</ion-list>
</ion-content>
</div>
<ion-router-outlet id="location-specifics"></ion-router-outlet>
</ion-split-pane> export class SplitPanePage {
closeMenu$ = this.store.selectedItem$.pipe(
map((val) => val && window.innerWidth <= 576),
);
} @media (max-width: 576px) {
ion-split-pane {
--side-min-width: 100%;
}
} The basic premise of the above is: when an item is selected AND the screen is smaller than the SM breakpoint (=576px), disable the split screen so the "menu" is not shown. In case no item is selected, only the menu is shown as the |
Issue number: resolves #18974 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When multiple menus on the same `side` are registered, all but the most recent menu are disabled. For example, if a user starts on PageA with a `start` menu and then navigates to PageB which also has a `start` menu, then the menu on PageA will be disabled. The problem is that if users navigates back to PageA they will be unable to open the menu on that view because it is still disabled. This behavior impacts any Ionic developer trying to open a menu whether by calling the `open` method on the menu itself or on the `menuController`. After discussing with the team, we believe the original intent of this behavior was to prevent users from accidentally opening the wrong menu when calling `menuController.open('start')`. This API allows developers to reference a menu by side, and since it's possible to have multiple menus on the same side it's also possible to open the wrong menu when referencing by side only. However, this API starts to break down pretty quickly in a navigation scenario. Sample Repo: https://github.com/liamdebeasi/multiple-menu-bug-repro ## Scenario 1: Referencing Menu by Side 1. On the "home" route click "Open 'start' menu". Observe that the home page menu opens. 2. Close the menu and click "Go to Page Two". 3. On the "page-two" route click "Open 'start' menu". Observe that the page two menu opens. 4. Go back to "home". 5. Click "Open 'start' menu". Observe that nothing happens. 6. Click "Enable and Open 'start'" Menu". Observe that the home menu opens. ## Scenario 2: Referencing Menu by ID 1. On the "home" route click "Open '#menu1' menu". Observe that the home page menu opens. 2. Close the menu and click "Go to Page Two". 3. On the "page-two" route click "Open '#menu2' menu". Observe that the page two menu opens. 4. Go back to "home". 5. Click "Open '#menu1' menu". Observe that nothing happens. 6. Click "Enable and Open '#menu1'" Menu". Observe that the home menu opens. ## Scenario 3: Using 3 or more menus even when enabling menus 1. On the "home" route click "Open 'start' menu". Observe that the home page menu opens. 2. Close the menu and click "Go to Page Two". 3. On the "page-two" route click "Open 'start' menu". Observe that the page two menu opens. 4. Close the menu and click "Go to Page Three" 5. On the "page-three" route click "Open 'start' menu". Observe that the page three menu opens. 6. Go back to "page-two". 8. Click "Open 'start' menu". Observe that nothing happens. 9. Click "Enable and Open 'start' Menu". Observe that nothing happens. The menu controller attempts to find an enabled menu on the specified side: https://github.com/ionic-team/ionic-framework/blob/a04a11be3571faa99c751edc034462e94a977e95/core/src/utils/menu-controller/index.ts#L79C12-L79C12 Step 6 is where this breaks down. In this scenario, the menus on "home" and "page-two" are disabled. This leads menu controller to use its fallback which tries to get the first menu registered on the specified side: https://github.com/ionic-team/ionic-framework/blob/a04a11be3571faa99c751edc034462e94a977e95/core/src/utils/menu-controller/index.ts#L86 This means that the menu controller would attempt to open the "home" menu even though the user is on "page-two" (because the start menu on "home" was the first to be registered). ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Menus are no longer automatically disabled when a new menu on the same side is registered - Referencing menus by side when multiple menus with that side exist in the DOM will cause a warning to be logged This change has a couple implications: 1. Developers no longer need to manually enable a menu as noted in https://ionicframework.com/docs/api/menu#multiple-menus. Note that continuing to manually enable the menus will not cause any adverse side effects and will effectively be a no-op. 2. Developers using the menuController to open a menu based on "side" may end up having the wrong menu get opened. Example before to this change: 1. Start on PageA with a `start` menu. Calling `menuController.open('start')` opens the menu on PageA. 2. Go to PageB with a `start` menu. Calling `menuController.open('start')` opens the menu on PageB because the menu on PageA is disabled. Example after to this change: 1. Start on PageA with a `start` menu. Calling `menuController.open('start')` opens the menu on PageA. 2. Go to PageB with a `start` menu. Calling `menuController.open('start')` attempts to opens the menu on PageA because both menus are enabled. However, since PageA is hidden nothing will appear to happen. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> I manually verified that removing the Angular Universal code does not regress the behavior fixed in #27814. The menu is never automatically disabled, so the bug does not happen. This is a partial fix for #18683. Properly fixing this requires another change which is out of scope for this work.
Hi everyone, Here is a dev build with a proposed fix if anyone is interested in testing: Install Example: |
Issue number: resolves #18683, resolves #15538, resolves #22341 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Menus in a split pane are hidden when a second split pane is mounted/made visible. This is because the `onSplitPaneChanged` callback does not take into account whether the it is a child of the split pane that emitted `ionSplitPaneVisible`. When split pane 2 is shown, that causes the menu is split pane 1 to hide. When split pane 1 is shown, the menu inside of it _is_ shown. However, since split pane 2 is then hidden that component also emits `ionSplitPaneVisible`, causing the menu inside of split pane 1 to hide. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Menus are only hidden when its parent split pane changes visibility ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `7.5.1-dev.11697568647.1ac87d08` --------- Co-authored-by: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com>
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. |
Issue number: resolves #18683, resolves #15538, resolves #22341 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> Menus in a split pane are hidden when a second split pane is mounted/made visible. This is because the `onSplitPaneChanged` callback does not take into account whether the it is a child of the split pane that emitted `ionSplitPaneVisible`. When split pane 2 is shown, that causes the menu is split pane 1 to hide. When split pane 1 is shown, the menu inside of it _is_ shown. However, since split pane 2 is then hidden that component also emits `ionSplitPaneVisible`, causing the menu inside of split pane 1 to hide. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Menus are only hidden when its parent split pane changes visibility ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `7.5.1-dev.11697568647.1ac87d08` --------- Co-authored-by: Amanda Johnston <90629384+amandaejohnston@users.noreply.github.com>
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. |
Hi. i am using 2 split-pane, firstmenu/firstpage will be my home screen. from firstpage i am navigating to secondmenu/secondpage. now when i return back to firstmenu/firstpage, the split-pane is getting hide, can someone help me on this please. see the screenshot and code below.
firstmenu/firstpage:
secondmenu/secondpage:
firstmenu/firstpage:
Below is the github repository to test this:
https://github.com/yogeshshsf/SplitpaneDemo
The text was updated successfully, but these errors were encountered: