Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Panda config polyfill & preflight options bug #2311

Closed
1 of 3 tasks
avegatolber opened this issue Mar 6, 2024 · 2 comments
Closed
1 of 3 tasks

Panda config polyfill & preflight options bug #2311

avegatolber opened this issue Mar 6, 2024 · 2 comments

Comments

@avegatolber
Copy link

Description

My initial problem was that I was trying to overwrite styles from external libraries with panda and it was not working, apparently it is because CSS outside of @layers will always have a bigger specificity than those inside.

So the solution I was told was to add polyfill: true in the panda configuration, and yes, that solves my problem but unexpected behaviors happened when I did it.

Link to Reproduction

https://codesandbox.io/p/sandbox/kind-mccarthy-ywfnvz

Steps to reproduce

First scenario

  • When set polyfill: true + preflight: true in panda.config.ts it overwrites the styles of all buttons with these styles:

    image

    image

    In this scenario I am already able to overwrite the external library styles but the button styles are broken.

Second scneario

  • To solve the style problem of the previous step I should have just let polyfill: true and preflight: false, but this produces another bug and that is that the layout breaks adding a scroll to the body.

    In this scenario I am already able to overwrite the external library styles but the layout is broken by the scroll it generates.

    image

JS Framework

React (TS)

Panda CSS Version

0.33.0

Browser

Google Chrome

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@astahmer
Copy link
Collaborator

astahmer commented Mar 6, 2024

I don't think there's any issue in Panda itself but it seems that the Panda preflight might not fit your use-case (you partially need it for the scroll issue but don't want it to affect the buttons)

so I'd suggest to generate it once, copy/paste it on your side and remove the parts you don't want

@avegatolber
Copy link
Author

avegatolber commented Mar 6, 2024

That solves my problem but aren't those styles that overwrite the background color of the buttons a bit invasive?

I suppose that those styles are intended to make the button as generic as possible and then with styles adapt it to the necessities of the application.

But it is common to have buttons from UI libraries and those styles break all the buttons styles.

@chakra-ui chakra-ui locked and limited conversation to collaborators Mar 6, 2024
@segunadebayo segunadebayo converted this issue into discussion #2315 Mar 6, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants