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

Allow to set a style-src CSP without unsafe-inline #8338

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ArthurWD
Copy link

@ArthurWD ArthurWD commented Mar 4, 2024

Closes #8043, #7600

📝 Description

This PR allows to set a style-src CSP without unsafe-inline

⛳️ Current behavior (updates)

Chakra currently uses both the style attribute on HTML elements and an injected style element. Both require unsafe-inline style-src.

🚀 New behavior

  • Uses direct style props like flex={1} instead of style={{ flex: 1 }}.
  • Uses __css instead of style where an style object is used.
  • Adds the option to pass a nonce to the ColorModeProvider where the style element is injected.

💣 Is this a breaking change:

No

📝 Additional Information

I was unable to test the behaviour locally, because I had issues linking to the local directory from my package.json. I haven't tested all changes myself, so please take a good look.

Also, there are some places where a style attribute is set on motion.div. I was not sure how to handle this, so I haven't fixed those issues.

Copy link

changeset-bot bot commented Mar 4, 2024

⚠️ No Changeset found

Latest commit: aab0c48

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Mar 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
chakra-ui-storybook ✅ Ready (Inspect) Visit Preview Mar 4, 2024 2:35pm
chakra-ui-website ❌ Failed (Inspect) Mar 4, 2024 2:35pm

@benmcginnis
Copy link

it would be really nice to get this merged, even though I know y'all are working on the v3 migration in earnest. this would be really helpful for those of us who're going to be on v2 for a while

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 this pull request may close these issues.

CSP error thrown by color-mode.util
2 participants