Dialog may cause flicker due to repositioning
I'm submitting a ... (check one with "x")
[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
It is difficult to recreate the issue but I made this animated gif that shows the behavior.
Current behavior

As the gif shows the left property is being set multiple times which makes the dialog to look like it has heart beat. the following is what happens in the dialog element that makes this behavior.

Expected behavior The dialog should stay still after the first centering.
Minimal reproduction of the problem with instructions This is hard, because this behavior does not happen all the times, but when it does it is annoying. I tracked down and the centering appears to be coming from ngAfterViewChecked which in itself calls the positionOverlay. ` positionOverlay() { let viewport = this.domHandler.getViewport(); if(this.domHandler.getOuterHeight(this.containerViewChild.nativeElement) > viewport.height) { this.contentViewChild.nativeElement.style.height = (viewport.height * .75) + 'px'; }
if(this.positionLeft >= 0 && this.positionTop >= 0) {
this.containerViewChild.nativeElement.style.left = this.positionLeft + 'px';
this.containerViewChild.nativeElement.style.top = this.positionTop + 'px';
}
else if (this.positionTop >= 0) {
this.center();
this.containerViewChild.nativeElement.style.top = this.positionTop + 'px';
}
else{
this.center();
}
}`
But the problem comes when the final else is being called repeatedly. This makes the dialog to appear as shown above, and when you click on the dialog this behavior goes away.
-
Angular version: 5.X 5.2.8
-
PrimeNG version: 5.X 5.2.2
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] All
Hi, I had a similar issue couple of weeks and I figure that in the document, it's mentioned that autoAlign is false by default. But, when I check the code, I noticed that autoAlign is true by default so try to set it to false like this:
<p-dialog [autoAlign]="false"></p-dialog>
Thanks for the workaround! But it still need to be fixed....
The above commit works like a charm!
Same trouble here. Thanks for the commit. Any news on when it'll be fixed ?
Will check for next week's 6.0.0-RC1. Thanks for the tip guys.