-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
List v2: default blocks styles (margin) applied to list items #42526
Comments
The Though Matías brough up a related question we need to look at: what happens to the new list block on a theme with a vanilla Something like the following should suffice: {
"styles": {
"blocks": {
"core/list": {
"spacing": {
"blockGap": "0"
}
}
}
}
} I need to check how block gap / layout works more in depth to know better. cc @andrewserong @ramonjd @aaronrobertshaw in case you can offer any thoughts. |
I can only see this at work in TwentyTwentyOne's editor CSS. So isn't this a case of the theme defining margins?
@oandregal I tested adding the following to TwentyTwentyOne's's theme.json "core/list": {
"spacing": {
"margin": {
"top" : "0",
"bottom": "0"
}
}
} This will add CSS to reset margins for I'm pretty sure Generally speaking, the logic for outputting block gap styles at the global level is in the Theme_JSON class. For block supports (that is, blockGap values in a block's style attributes) it's in layout.php. @andrewserong for a fact check 😄 |
That's correct — to enable spacing between |
Another thing to keep in mind, is that flow-based (default) Layout gap styles are not output in Classic themes, or blocks-based themes that have not opted-in to blockGap. So depending on how the block is being built, the simplest approach might be for the block to ship with some opinionated CSS? |
TLDR. I understand we can close this issue because:
Longer context. This is what I did: Using TwentyTwentyTwo, I set A second experiment I ran was: how can I intentionally control the spacing between the list items? Guided by your directions, this is what I did:
I'm probably missing things to make this work, as I haven't really dug into the layout work. In any case, controlling the spacing between list items is out of the scope for list v2 and can be looked at after, if it's something we want to implement. |
We currently have the following CSS applied to all blocks:
But for list items this isn't a good default. I don't think this generally is a good default to have either. Themes should define margins, not us. I remember discussing this with @jasmussen once upon a time.
The text was updated successfully, but these errors were encountered: