-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
menu: appendTo values other than body not working correctly in v18 #16795
Comments
Good catch! Thanks a lot for your report! |
In Angular 18.1.1 and primeng 17.18.5 the same problem occurs |
same environment than @epitzalis commented, same problem |
Using primeng v.19.0.5, with angular version 19.0.5. Using p-menu component with an [appendTo] value different from 'body' makes p-menu never closing (i guess it's something about bubbling event behavior). INITIAL: SCROLLING: |
This is still an issue for me, is there a workaround that you know of? I am using a table and a split button. The menu comes up at the bottom of the page.
|
I have fix it using a CSS class like this <p-menu class="foo__sort-menu" [model]="sortOptions" [popup]="true" #sortMenu> &__sort-menu { now it works the way I want because first I possitioning the class name sort-menu of the p-menu relative to the button i want to place it (it has to have a position: relative) , and once positioned, change it to fixed. I didn't know this feature about css, but it uses the previous absolute position for then fix the position around it. |
Thank you so much! For the table I ended up making the 'td' relative
And added this global style.
As the [appendTo]="body" was behaving strangely. |
Describe the bug
When
Menu.appendTo
is set to a value other than"body"
the menu items are not appended to the element passed via template ref, but rather the element is appended to the menu items.Changing the order of the parameters fixes this:
This actually appears to be backwards everywhere that the @primeuix/utils version of
appendChild
is called.Environment
Fresh download of the
v18
branch running the showcase app with a menu added to a button will reproduce this. Personally running on an Apple silicon Mac with node 18.19.1.Reproducer
https://stackblitz.com/edit/github-l2mr75?file=src%2Fapp%2Fapp.component.html
Angular version
18
PrimeNG version
18.0.0-rc.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.19.1
Browser(s)
No response
Steps to reproduce the behavior
Menu
component with[appendTo]="someTemplateRef"
menu.ts
to reverse the order of the parameters forappendChild
Expected behavior
Menu items should appear appended to the element passed in via
appendTo
The text was updated successfully, but these errors were encountered: