maitrungduc1410 / primeng-shadowdom-directives

Directives that make PrimeNG plays nicely with ShadowDOM
https://maitrungduc1410.github.io/primeng-shadowdom-directives/
MIT License
9 stars 3 forks source link

Tooltip: incorrectly calculated left and top position when not appended to body #10

Closed metalloid66 closed 9 months ago

metalloid66 commented 1 year ago

We are building our project with encapsulated web components architecture. E.g, we would have 3 independent web components inside our main application, each component with their own import of PrimeNG lib. In order to achieve this independence of components (avoiding style leaks from different PrimeNG versions in different web components etc.) we are encapsulating the root web components with ShadowDom. Of course, this brings about the errors that come with using PrimeNG components in the ShadowDom.

We are currently testing your library as a solution and most of the components seem to be working fine. However, we are facing issues with the Tooltip component. To avoid leaking the Tooltip to the parent application (as parent application might not have PrimeNG) we are appending the Tooltip somewhere inside of the web component itself. For example appendTo = 'target', or [appendTo]='someWebCompWrapper'. However, it seems like for these situations the Tooltip's position is always miscalculated.

Could you please provide a solution for miscalculated overlays positions (We have only found tooltip's position to be faulty for the time being) with appendTo set to something other than 'body'?

cmyk1 commented 1 year ago

Is there any fix for this issue?

maitrungduc1410 commented 1 year ago

For your issue, I think:

What I found after all of this is, no matter whether you're working with shadowDom or not, 99,99% you should use appendTo=body to avoid any issue with "overlay" components