-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(layout): ensure locally defined layout definition has precedence #19406
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
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19406 +/- ##
=======================================
Coverage 84.85% 84.85%
=======================================
Files 371 371
Lines 14413 14413
Branches 4694 4694
=======================================
Hits 12230 12230
Misses 2037 2037
Partials 146 146 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
LGTM, thanks!
c640f58
Closes #19388
When a component redefines layout tokens (such as size), the selector
.cds--layout--{group}-{step} .{component}
is created.As outlined in the linked issue, if a
<Button>
'sprops.size
is set tolg
, it emits the class name.cds--layout--size-lg
. If you were to place a<Tag>
(which redefines layout tokens) inside of the button, the selector.cds--layout--size-lg .cds--tag
would be matched and receive precedence over the locally defined size.This PR adds a second selector that is being emitted:
.{component}.cds--layout--{group}-{step}
which takes precedence in this case (.cds--tag.cds--layout--group-sm
would be matched) as the specificity of the original selector has been lowered (.cds--layout--{group}-{step} :where(.{component})
).Changelog
Changed
layout.redefine-tokens
as described above.Testing / Reviewing
PR Checklist
As the author of this PR, before marking ready for review, confirm you:
Wrote passing tests that cover this changeMore details can be found in the pull request guide