primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Dialog may cause flicker due to repositioning

Open ASK83 opened this issue 8 years ago • 5 comments

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 dialog2

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. dialog-element

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

ASK83 avatar Mar 20 '18 13:03 ASK83

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>

LoganFievez avatar Mar 27 '18 13:03 LoganFievez

Thanks for the workaround! But it still need to be fixed....

tleveque23 avatar Apr 02 '18 18:04 tleveque23

The above commit works like a charm!

kyleabens avatar Apr 11 '18 12:04 kyleabens

Same trouble here. Thanks for the commit. Any news on when it'll be fixed ?

Elanor-L avatar May 23 '18 13:05 Elanor-L

Will check for next week's 6.0.0-RC1. Thanks for the tip guys.

cagataycivici avatar Jun 08 '18 07:06 cagataycivici