Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS leaking #138

Closed
marviobezerra opened this issue Apr 18, 2024 · 17 comments · Fixed by #139
Closed

CSS leaking #138

marviobezerra opened this issue Apr 18, 2024 · 17 comments · Fixed by #139

Comments

@marviobezerra
Copy link

There is CSS leaking after updating from 0.8.0 to 0.9.0. It's setting background color, font, and others on components that are not Jotai Dev tools.

I noticed that it's adding the whole @mantine css to my project.

@arjunvegda
Copy link
Member

Thanks for reaching out!

We have a known issue when customers use Mantine in their main app along with Jotai, the theme would not work as expected (light/dark mode). Our recommendation is to sync the theme via props. Please see this warning.

If this issue is different, could you please create a small repro? Happy to look into it.

@marviobezerra
Copy link
Author

marviobezerra commented Apr 18, 2024

I don't use Mantine, in my case I use Panda CSS. Moreover, importing the CSS file, based on the documentation, leaks Mantine to all my application affecting all my styles. It also happens if I'm running in dev or prod mode. The devtools is supposed to be available on dev more, correct?

@arjunvegda
Copy link
Member

Could you please create a small repro perhaps on CSB?

@arjunvegda
Copy link
Member

I think I know what's going on here. We're including global styles that affect the body tag. For now, could you try overriding your style with !important while I look into the fix?

@arjunvegda
Copy link
Member

Hey @marviobezerra

Could you test this canary tag and see if that fixes the issue for you? - https://ci.codesandbox.io/status/jotaijs/jotai-devtools/pr/139/builds/496213 (Follow Local Install Instructions)

@marviobezerra
Copy link
Author

I'll try tomorrow morning and post back. Thanks for the quick response.

@sebinsua
Copy link

sebinsua commented Apr 19, 2024

@arjunvegda It's still broken because of these styles:

seems-to-still-do-global-things

Particularly font-size: inherit is causing the size of my buttons to be wildly off what they should be.

For now I'm making the styling lazily load and putting it behind an environment variable that switches jotai-devtools on. That way, at least we don't get broken styles normally when developing.

@arjunvegda
Copy link
Member

@sebinsua - you could also downgrade it to 0.8.0 temporarily until we figure this out. Sorry for the hassle!

Re: css-reset styles, what's a good way to remove them? I think the inherit problem is that Mantine is not designed to be used for libraries 🤔 But it drastically helps us in adding new features without having to maintain our own library.

Should we write our own post css plugin that removes the css reset styles?

@marviobezerra
Copy link
Author

I tried and it still leaking. I downgraded to 0.8.0 and it's working.

@arjunvegda
Copy link
Member

Could you folks test the latest change https://ci.codesandbox.io/status/jotaijs/jotai-devtools/pr/139/builds/496725 ?

@sebinsua
Copy link

Could you folks test the latest change https://ci.codesandbox.io/status/jotaijs/jotai-devtools/pr/139/builds/496725 ?

This seems to be working for me.

@kvnxiao
Copy link

kvnxiao commented Apr 23, 2024

@arjunvegda this is still not fixed on https://pkg.csb.dev/jotaijs/jotai-devtools/commit/992cb72f/jotai-devtools. I am using tailwindcss and the default "light" theme is overwriting some default global CSS styling.

  1. Affects input elements and applies a black background to them
  2. Text selection background highlight color is changed globally to the current chosen jotai devtools theme

@arjunvegda
Copy link
Member

Thanks for reporting @kvnxiao! Could you try this tag https://pkg.csb.dev/jotaijs/jotai-devtools/commit/57787cb3/jotai-devtools/_pkg.tgz? If this does not fix the issue, then could you please create a small repro on CodeSandbox?

@pulsedemon
Copy link

@arjunvegda I've been having the same issue. installed from https://pkg.csb.dev/jotaijs/jotai-devtools/commit/57787cb3/jotai-devtools/_pkg.tgz and can confirm this fixes it for me

@arjunvegda
Copy link
Member

Released the fix in v0.9.1. Please feel free to re-open this issue if the problem persists.

@sebinsua
Copy link

thank you for this!

@Elvincth
Copy link

The same issue in v0.10.0 it leaks the CSS and alters mantine menu style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants