Skip to content
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

Open
jasonverber opened this issue Nov 20, 2024 · 0 comments · May be fixed by #16796
Open

menu: appendTo values other than body not working correctly in v18 #16795

jasonverber opened this issue Nov 20, 2024 · 0 comments · May be fixed by #16796
Assignees
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Milestone

Comments

@jasonverber
Copy link
Contributor

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.

appendOverlay() {
        if (this.appendTo) {
            if (this.appendTo === 'body') this.renderer.appendChild(this.document.body, this.container);
            else appendChild(this.container, this.appendTo);
        }
    }

Changing the order of the parameters fixes this:

appendOverlay() {
        if (this.appendTo) {
            if (this.appendTo === 'body') this.renderer.appendChild(this.document.body, this.container);
            else appendChild(this.appendTo, this.container);
        }
    }

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

  1. Install PrimeNG 18
  2. Use the Menu component with [appendTo]="someTemplateRef"
  3. Observe the menu does not appear where it should.
  4. Update menu.ts to reverse the order of the parameters for appendChild
  5. Observe the menu does appear where it should.

Expected behavior

Menu items should appear appended to the element passed in via appendTo

@jasonverber jasonverber added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 20, 2024
@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 21, 2024
@mertsincan mertsincan added this to the 18.0.0-rc.2 milestone Nov 21, 2024
@mertsincan mertsincan self-assigned this Nov 21, 2024
@mertsincan mertsincan linked a pull request Nov 21, 2024 that will close this issue
@mertsincan mertsincan modified the milestones: 18.0.0-rc.2, 18.0.0.Final Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants