Primeng: p-overlayPanel in a position:sticky div in a scrollable container has bad position

Created on 6 Feb 2018  路  11Comments  路  Source: primefaces/primeng

Hi,
I just tried to add a p-overlayPanel in a div with a sticky behavior. This div is inside a scrollable container so appendTo="body" cannot be use (or the overlay won't follow the scrolled content).

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)
http://plnkr.co/edit/20NH9GgGoeLQQzsTYmhn?p=preview

Current behavior
The overlayPanel is wrongly positioned.
If I add appendTo="stickyRef" nothing changes.
If I add appendTo="body" it is well positionned BUT it does not follow the scroll.

Expected behavior
It should be positioned right under the button and follow the scroll.

Minimal reproduction of the problem with instructions
http://plnkr.co/edit/20NH9GgGoeLQQzsTYmhn?p=preview
Click on Basic overlay, the overlayPanel appears far from the button.
add appendTo="body" to the overlayPanel.
Click on Basic overlay, the overlayPanel appears right under the button.
Scroll the div, the overlayPanel doesn't stick to the button.

Please tell us about your environment:
Windows 7, Google Chrome

  • Angular version: 5.1.1

  • PrimeNG version: 5.0.2

  • Browser: [Chrome 63]

  • Language: [TypeScript 2.6.1]

Most helpful comment

@cagataycivici
It does not solve the issue:
I follow the examples from tooltips, weird behavior is still there.

<div #overlayAnchor  style="display:inline-block;position:relative">
    <button pButton
            (click)="overlayPanel.show($event)"
            [label]="abc"
            ></button>
    <p-overlayPanel #overlayPanel [appendTo]="overlayAnchor">
         someContent
    </p-overlayPanel>
</div>

The position of the overlay panel is incorrectly calculated !

All 11 comments

You need to create a wrapper div that contains the button and the overlay panel and append the overlap to this div. Tooltip documentation has an example.

@cagataycivici
It does not solve the issue:
I follow the examples from tooltips, weird behavior is still there.

<div #overlayAnchor  style="display:inline-block;position:relative">
    <button pButton
            (click)="overlayPanel.show($event)"
            [label]="abc"
            ></button>
    <p-overlayPanel #overlayPanel [appendTo]="overlayAnchor">
         someContent
    </p-overlayPanel>
</div>

The position of the overlay panel is incorrectly calculated !

I am seeing the same behavior as @Kiiiwiii

was there a solution?? I am having the same issue. I tried all the solutions mentioned above.

Please reopen it. I have the same problem.

i have same problem with overlayPanel
Please reopen it
@cagataycivici
image
I must opend down of blue button

I have same problem and tried a day to fix it.
I tried above solutions as well, nothing worked.
Please reopen it and please provide a solution.

same issue here.
this situation is under verification at this post
https://github.com/primefaces/primefaces/issues/1369

Thank you! @rhafiko

Any fix for this ?

Yes are there any fix for this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

just-paja picture just-paja  路  3Comments

cyberrranger picture cyberrranger  路  3Comments

jisqaqov picture jisqaqov  路  3Comments

Faigjaz picture Faigjaz  路  3Comments