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

Dialog/OverlayPanel error when using appendTo #6168

Closed
Spiral1401 opened this issue Jul 26, 2018 · 9 comments
Closed

Dialog/OverlayPanel error when using appendTo #6168

Spiral1401 opened this issue Jul 26, 2018 · 9 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Spiral1401
Copy link

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting

Plunkr Case (Bug Reports)
https://github-df7qmz.stackblitz.io/

Current behavior
When the dialog is not visible, hiding its containing element via ngIf (causing dialog OnDestroy) causes an error when using the appendTo attribute

Expected behavior
I'm not sure exactly what is supposed to happen here, but not the error of course :)
Maybe old code that tries to put the dialog back in its "non-body appended" place but with the dialog getting removed from the DOM in 6.0.2 that isn't a thing anymore. Anyway, you guys get it.

Minimal reproduction of the problem with instructions
In stackblitz, show the dialog. Toggle the container back and forth, everything is fine. Hide the dialog, and as soon as you hide the container you get the error.

ERROR TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
at Dialog.restoreAppend (dialog.ts:555)
at Dialog.ngOnDestroy (dialog.ts:590)

@dhakehurst
Copy link

+1

4 similar comments
@ivan-meridianbanc-com
Copy link

+1

@victos
Copy link

victos commented Jul 27, 2018

+1

@DanielChicot
Copy link

+1

@opetriienko
Copy link

+1

@jmesa-sistel
Copy link
Contributor

@cagataycivici
A temporary fix is change the function restoreAppend in dialog.js in node_modules
change

if (this.appendTo) {
    this.el.nativeElement.appendChild(this.container);
}

to

if (this.appendTo && this.container) {
    this.el.nativeElement.appendChild(this.container);
}

@dorje42
Copy link

dorje42 commented Jul 30, 2018

The problem occours if you use an overlaypanel. The temporary fix from @jmesa-sistel also works, if you patch the file overlaypanel.js in primeng/components/overlaypanel/

@cagataycivici cagataycivici self-assigned this Aug 1, 2018
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 1, 2018
@cagataycivici cagataycivici added this to the 6.1.0-rc.1 milestone Aug 1, 2018
@cagataycivici cagataycivici changed the title 6.0.2 Dialog error when using appendTo Dialog/OverlayPanel error when using appendTo Aug 1, 2018
@cagataycivici
Copy link
Member

Resolved for 6.1.0-rc.1 (due tomorrow)

@lharley
Copy link

lharley commented Nov 8, 2018

appendTo={document.body} -- worked perfectly for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

10 participants