-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix(Chip): avoid reassigning custom properties #3019
Conversation
🦋 Changeset detectedLatest commit: 2118ca4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Preview deployments for this pull request: Storybook - |
Coverage Report
File CoverageNo changed files found. |
Just to make sure we are on the same page here, is this the issue you are trying to resolve? I'm not too sure if this is an issue 🤔 It comes down to how you look at it:
I don't think this is a clear cut issue, and I think it needs at least some discussion.. Feel free to add comments directly to this PR. |
I think we need to huddle to make sure we all understand the issue correctly |
Sure, but this also needs to be documented properly, and understandable, on github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only requesting changes so we don't accidentaly merge this without having the discussion tomorrow
@Barsnes The issue is that if I overwrite An exampleIn my project:
If I do this, the reassignment of In designsystemet/packages/css/src/chip.css, line 98–108:
I can get around this by copying the code to my project, and reassign every custom property in the Designsystemet CSS file, basically re-implementing the Designsystemet CSS file line by line. However, I don't see this as scalable. Any change to this CSS file in Designsystemet could be a breaking change to my implementation. That would be very tedious. Luckily, it's solvable by assigning the custom property values to native CSS properties, instead of reassigning the custom properties themselves. This example can be solved by writing it like this, as my PR suggests:
|
Right, so just like my codesandbox? |
@Barsnes Sorry, unfortunately I don't understand your explanation in the codesandbox 😅 Can you explain in more detail? |
We'll make separate issue on how to solve variants and override styling with CSS variables. |
Since Designsystemet is placed in a CSS layer, we can not reassign custom properties in case the consumer wants to overwrite them. Therefore we need to only assign native CSS properties, in order for them to be able to overwrite. --------- Co-authored-by: Eirik Backer <eirik.backer@gmail.com>
Since Designsystemet is placed in a CSS layer, we can not reassign custom properties in case the consumer wants to overwrite them. Therefore we need to only assign native CSS properties, in order for them to be able to overwrite.