primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Tailwind: inside a shadowHost, CSSfrom the filter overlay in DataTable is purged

Open rogiermulders opened this issue 3 years ago • 6 comments

Describe the bug

I'm using Primereact in the sahdowHost. I'm experimenting now with Tailwind but stumbled upon the following issue.

When using Primereact with Tailwindcss inside a shadowHost, css from the filter overlay in DataTable in is purged by PurgeCSS I think.

Maybe all overlays have the same problem. I did not test those.

Reproducer

https://stackblitz.com/edit/vitejs-vite-nuemax?file=src%2Fmain.jsx

PrimeReact version

10

React version

18.x

Language

ALL

Build / Runtime

Vite

Browser(s)

all

Steps to reproduce the behavior

See stackblitz.

Click on the filter icon and you get tailwind class names inside the overlay but the CSS is purged I think

Expected behavior

Non puregd css so the filter overlay is styled

rogiermulders avatar Nov 04 '23 14:11 rogiermulders

Definitely looks like an issue I assigned to PrimeTek and marked it as Tailwind issue. @bweis do you know if your fix will fix this issue as well?

melloware avatar Nov 05 '23 15:11 melloware

@melloware Ai... I was wrong here. This issue has nothing to do with Tailwind or the purging of CSS. The issue is that the DataTable has not an 'appendTo' property as for instance the Dialog has. The filter dialog is appended to the normal document root and not to the shadow DOM, that's why it's not styled.

I chaged Stackblitz a bit, added the Dialog. If you remove the appendTo property from the Dialog it acts the same.

So it is more a request I guess to add an appendTo property for the filter overlay.

It might be a feature request this one.

rogiermulders avatar Nov 05 '23 21:11 rogiermulders

I think you can do it globally https://primereact.org/configuration/#appendto

melloware avatar Nov 05 '23 21:11 melloware

@melloware Wow missed the new confif option, nice!

Still have some issues though.

Screenshot from 2023-11-06 09-36-16

I guess I'll change the title

rogiermulders avatar Nov 06 '23 08:11 rogiermulders

It's getting too far of the topic. I close this one and create a new issue

rogiermulders avatar Nov 06 '23 09:11 rogiermulders

Getting too far off topic

rogiermulders avatar Nov 06 '23 09:11 rogiermulders