question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CSSReset] When resetCSS is false, Chakra is still overriding body styles

See original GitHub issue

🐛 Bug report

I have resetCSS set to false in my chakra provider, but I’m still getting body styles overridden by chakra.

💥 Steps to reproduce

  1. Set resetCSS to false in the chakra provider.
  2. Check the styling for a piece of text and see that it’s still getting body styling from chakra.

💻 Link to reproduction

Please create a minimal reproduction in CodeSandbox https://codesandbox.io/s/strange-dhawan-phri5?file=/src/App.tsx

🧐 Expected behavior

Either the body styles shouldn’t be overridden, or there should be a way to prevent this.

🌍 System information

Software Version(s)
Chakra UI 1.0.3
Browser Chrome
Operating System MacOS

📝 Additional information

Screen Shot 2020-12-15 at 2 28 07 PM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
bazookanucommented, Dec 4, 2021

Agree with @nahumzs- my use case is to inject a chat component into existing web pages. So I’d like to restrict Chakra CSS to that component only.

10reactions
nahumzscommented, Nov 25, 2021

I have been testing chackra in a prototype for some time now, I honestly can’t understand how a simple component like the Box component will inject so many global styles and resets, IMHO Styles within the scope of a UI library should be agnostic and specific to the component that you want to use, having this global concept of styles plus forcing a reset in an application decrease heavily the chances for a serious application to adopt chackra partially.

Pretty much at this point is all in with chakra you adopt it or you don’t, also even if you adopt it I can see many conflicts with third party components that you might want to use in your application, this can be brutal if you don’t have access to the styles for third party components. 😦

It would be great to have a function like:

import { avoidCSSInjection } from "@chackra-ui/core"

avoidCSSInjection()

And prevent this from happening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I see, these global styles are set by default.
[CSSReset] When resetCSS is false, Chakra is still overriding body styles ... but I'm still getting body styles overridden by chakra.
Read more >
reactjs - Markdown is not being displayed correctly due to ...
I solved the problem by adding the default CSS of HTML tags to the global styles in theme.js. But this feels like a...
Read more >
Frontend Handbook | React / Chakra UI
Chakra factory will be defined with base style and can be overridden by sx prop because baseStyle is merged before sx .
Read more >
Upgrading to v1
This is useful if you're not a fan of style props, and prefer passing all styles in ... CSSReset: To omit the recommended...
Read more >
CSS Tip #1: Resetting Your Styles with CSS Reset
Reset CSS is the process of resetting the styles of all elements to a baseline value to avoid cross-browser differences. Learn more here!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found