Lower specificity of padding declaration in group block.#34854
Lower specificity of padding declaration in group block.#34854
Conversation
|
Hat tip for the |
|
Size Change: +29 B (0%) Total Size: 1.06 MB
ℹ️ View Unchanged
|
|
Love it. I'll give it a proper test tomorrow in a few themes, but from what I can tell from the code, this one is solid, it's good use of the selector. It lowers the specificity of the default rules to be useful when nothing else is applied, but overridable by global styles, and in turn overridable by themes. |
|
Tested with a classic theme with theme.json, and block themes. This PR works well for the group block. The problem is not limited to the group block, I think it needs to be updated for every block that changes the padding when there is a background color. |
jasmussen
left a comment
There was a problem hiding this comment.
I have my own group block + has-background rule, which looks like this by default:
.wp-block-group :where(.has-background) {
padding: $grid-unit-40;
}
That's in my editor style.
When I add properties to my theme.json, this:
"core/group": {
"spacing": {
"padding": {
"top": "100px",
"right": "100px",
"bottom": "100px",
"left": "100px"
}
}
},
I correctly get a 100px padding:
When I specifically set, using inspector controls, a padding of zero, I get this:
Indeed, this is something that can and probably should be adressed across the core blocks. |
ad44d1e to
642e808
Compare
642e808 to
f527642
Compare
|
Rebased to get #34874 in (so the e2e test passes). |



Fixes #33456
This PR lowers the specificity of the padding declaration for the group block when it has a background attached, so other styles (including global styles) can override them.