-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Try additional CSS selectors for Button block styles #36130
Conversation
@@ -77,7 +77,8 @@ | |||
"radius": true, | |||
"__experimentalSkipSerialization": true | |||
}, | |||
"__experimentalSelector": ".wp-block-button__link" | |||
"__experimentalSelector": ".wp-block-button__link", |
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.
We could also just change this to include the additional selectors...
Size Change: +189 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
Hey, this is an issue and there are some alternatives:
I'd think this PR is too risky to add for 5.9. It raises the question as to why a given block (button) should control other block's styles (search & files): this breaks the block contract (each one is isolated from the others). If we still wanted to go with this, at the practical level, we'd need to test this works well as we may run into multiple specificity clashes. One potential way forward would be to move this to the theme territory until core has a solution. I'd do something similar to what I suggested here #34141 (comment) TLDR: generate css custom properties that track the button styles to reuse in whatever other blocks the theme wants. |
Tried that here, it works but this feedback is still relevant, just defers it to the theme:
Closing this PR for now until we more clarity around how styling these elements should be handled. |
Description
In Twenty Twenty-Two, we want to style the buttons in the Search block and File block, and we want them to be consistent with the button block styling. This might ideally be done via theme.json in the future, but needs more consideration (see #29167).
We don't want to write CSS to target these buttons because those styles would not be configurable via global styles. So I had a different idea — output additional selectors to the same CSS declaration generated from theme.json's
styles.blocks.core/button
, to target the buttons inside the Search and File block.This PR does two main things:
Questions
How has this been tested?
Screenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).