-
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: wrapped menu does not work with content property #16304
Comments
Hi thank you so much ! |
Thanks for your issue! That seems to be like a bug. A workaround would be this:
|
Thank you for your answer ! So it is impossible to apply the principle of angular and to cut the components ? |
Okay, sry. I've updated my answer above. It's a bug, you are right :) |
No problem, I will look in my side If I have the time and wait the next version to test :) |
I've spent some time with it today. At the moment it's not possible to put it inside a child component in fact of the following: He is looking if the split pane is the parent element. If you put it inside a child component, this will lead to false inside the ion-menu. It can be fixed by looking through another parentElement like so:
This would lead that it returns true on the ion-menu. But we need to stop this after some circles otherwise he would walk through all elements (not good). But now we have another issue: As you can see ion-menu has to be a child of split-pane Now you could say: And if we remove this child selector? Problem would be, if you have more than one split-pane, then another menu would become visible So split-pane has to be refactored. So it's a feature request, not a bug :) |
I often have the use case where I have a main root side menu on the left, which is ever-present in the app. Then specific page(s) will have a right "menu." I hesitate to call the right ones menus; they are sub-functionality for a specific pages (and should be easily accessible from the page's scope/code). It's something that a popover could probably do, but a menu on the right feels better and swiping from the right edge is nice. Maybe there should be a distinction between menus and drawers, with the latter being sub-components of pages. |
yes why not ... personally I find the menu component poorly designed. why not allow to put it in a proper component to him directly ? especially to simplify unit tests. I take the example of my project where I have several roles and I initialize the menu according to the roles. I also encounter the problem that I can not activate the menu once authenticated with a * ngIf because the expression false true is already verified because the menu is in the app.component |
I too am trying to get my "drawers" (side-menus within pages) to work.
I keep getting this error message:
|
Please try.... Home.html
https://stackoverflow.com/questions/53657275/ionic-4-adding-side-menu |
I've been trying to put the side menu into a separate component for a couple of days, and found the following seems to work? In app.component.html ... In sidemenu.component.html ...
i.e. move the entire contents of the split pane to the menu component, including ion-router-outlet. There is a working example here... https://github.com/PurpleEdge2214/Ionic4-Side-Menu-as-a-Component---Example |
@Yogeshjuya1993, @PurpleEdge2214 I don't understand how this solves the issue of wanting to have "drawers"? (In any way I thank you for sharing your insights.) |
Is the final answer here that you can't put a side menu is a custom component? Going from @Yogeshjuya1993's comment i have this in app.component.html
and in my custom header component.html i have this:
then, on every page i want my header (with side menu button), i add this: it almost works. On the start page when app runs, it works (except menu button is hidden when menu opens); but on every subsequent page, the button shows but doesn't do anything (and no errors); and returning to start page, it also no longer works. |
Hmm.. i had MenuController imported on one of my pages; this may have been breaking it. |
It's too bad that the functionality has changed since v3. With a v3 project it was straight forward to have ion-menu components on multiple pages/components of the application. This provided more flexibility with the contents of the menu, as well as functionality. It seems that the new implementation of this component intends for ion-menu to only be used for routing. I agree with @iTEEECH, I find the way that this component has been designed to be poor. The implementation for v3 provided far more flexibility |
Any update on this? I'm on v5 and I get this error in production but not in development mode. On debugging found that it happens with SSR. So might be related to this issue ionic-team/stencil#2119 |
bug is actual with #24907 |
Hi everyone, Here is a dev build if anyone is interested in testing a proposed fix: Install example:
Please note that this is an Ionic 8 build and is subject to the Ionic 8 breaking changes. |
Issue number: resolves #16304, resolves #20681 --------- <!-- 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. --> Split Pane assumes that Menu is a child of the Split Pane. This means that CSS selectors and JS queries only check for children instead of descendants. When a Menu is encapsulated in a component that component can itself show up as an element in the DOM depending on the environment. For example, both Angular and Web components show up as elements in the DOM. This causes the Menu to not work because it is no longer a child of the Split Pane. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Menu can now be used as a descendant of Split Pane. The following changes make this possible: 1. When the menu is loaded, it queries the ancestor Split Pane. If one is found, it sets `isPaneVisible` depending on if the split pane is visible or not. 2. Any changes to the split pane visibility state after the menu is loaded will be handled through the `ionSplitPaneVisible` event. 3. A menu is now considered to be a pane if it is inside of a split pane 4. Related CSS no longer uses `::slotted` which only targets children. The CSS was moved into the menu stylesheets. I consider the coupling here to be valuable as menu and split pane are often used together. We also already have style coupling between the two components, so this isn't anything new. ## Does this introduce a breaking change? - [ ] Yes - [x] No There are no known changes to the public API or public behavior. However, there are two risks here: 1. There is an unknown risk into how this change impacts nested split panes. This isn't an explicitly supported feature, but it technically works in Ionic now. We don't know if anyone is actually implementing this pattern. We'd like to evaluate use cases for nested split panes submitted by the community before we try to account for this functionality in menu and split pane. 5. There may be some specificity changes due to the new CSS. CSS was moved from split pane to menu so it could work with encapsulated components: `:host(.split-pane-visible) ::slotted(.split-pane-side)` has a specificity of 0-1-1 `:host(.menu-page-visible.menu-pane-side)` has a specificity of 0-1-0 There shouldn't be any changes needed to developer code since the selectors are in the Shadow DOM and developer styles are in the Light DOM. However, we aren't able to anticipate every edge case so we'd like to place this in a major release just to be safe. ## 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.6.2-dev.11704922151.1fd3369f`
Thanks for the issue. This has been resolved via #28801, and a fix will be available in an upcoming release of Ionic Framework. We are shipping this in a major release of Ionic to de-risk some of the internal infrastructure changes we made to resolve this bug. Feel free to continue testing the dev build, and let me know if you run into any issues. |
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. |
Ionic Info
Describe the Bug
When putting the menu inside a custom component, (app-menu) to make the app component less busy, I get this result :
https://ibb.co/kUDFOV
But normally, I have to have the initial result :
https://ibb.co/cFcLqA
Steps to Reproduce
1 - Generate a new app with menu
2 - Put the ion-menu in the app-menu
<ion-menu contentId="content1" > <ion-header> <ion-toolbar> <ion-title>Menu</ion-title> </ion-toolbar> </ion-header> <ion-content> <ion-list> <ion-menu-toggle auto-hide="false" *ngFor="let p of appPages"> <ion-item [routerDirection]="'root'" [routerLink]="[p.url]"> <ion-icon slot="start" [name]="p.icon"></ion-icon> <ion-label> {{p.title}} </ion-label> </ion-item> </ion-menu-toggle> </ion-list> </ion-content> </ion-menu>
3 - Put the following in app.component:
<ion-app> <ion-split-pane> <app-layout-menu contentId="content1" [content1]="content"></app-layout-menu> <ion-router-outlet id="content1" main [swipeBackEnabled]="true"></ion-router-outlet> </ion-split-pane> </ion-app>ion
Thank you for your answers !
The text was updated successfully, but these errors were encountered: