-
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
Consider adding bottom margin to some blocks #15668
Comments
Great ticket, thank you. Looking over #14407 again, it doesn't look like it specifically removed any margins from the Media & Text block. In fact I haven't updated my own site yet, it's still 5.1 which I'm pretty sure doesn't ship with that change. And things look the same as you describe here. Editor: Frontend: However this ticket is still valid, and I happen to agree with you, Media & Text deserves to be born with an intrinsic bottom margin (i.e. in style.scss, not just theme.scss). The reason being: it's an entirely new block. There's also precedence for doing it in such cases, here, an explicit bottom margin is applied to the columns block: So long as this margin is trivial to override and customize for themers, I would suggest it's good to still add. Next step could be a PR that does the same as is referenced just above for the columns block. |
Honestly, i do not think adding any automatic padding/margin would be a good idea. If you still can not give up this idea, please set the margins/paddings to 0 by default and implement sliders on the right sidebar where users can choose the size and even the unit of the top/bottom/left/right margins. Otherwise all that would cause more harm than joy. |
Ah sorry — I'm talking about a lot of blocks here. 😄 I was referring to the Cover block, which used to have a bottom margin. That was definitely removed in #14407, so now the Cover block suffers from the same problem described in this PR.
Just to be clear: we're only talking about the bottom margin, which still does exist for the columns block today. The goal here is to ensure that things don't look broken on themes that don't supply styles to these blocks by default. Adding block margin/padding controls are still a possibility, and tracked in #11824. |
I understand what the goal is, however hardcoding margins/paddings in GB without clearly informing the user just screws things up (not mention what may happen if GB hardcodes another unit type than theme coder particularly in case of paddings/margins) In #12640 i was really frustrated just because of the hard coded margins/paddings i did not expect at all while coding my CSS for a client. Others reported the same issue in #12199 and #13035. Please take a look at the bottom of this image and notice how an unexpected bottom margin can screw up a real design. So a i am not against the idea but please do it with settable sliders and unit types, deafaulting to 0. That way newbies and experts can set those with the same ease and neither user type gets frustrated. I also understand that designers of GB want to keep everything minimalistic, but computers need to be instructed as they still can not read our minds :-) |
Thanks for sharing, @idea--list. I can definitely relate to that sort of thing being frustrating. I'm a theme developer too, and I've had to write theme styles to override that sort of quirk too. It's definitely something that Gutenberg could address through issues like #11824: that approach would turn those margins from a theme developer's decision into a user decision. But regardless of whether or not that lands in a PR, the core of the conflict here is just that the Media & Text block comes with a bottom margin by default in the editor, but does not in the front end. I'd like for us to even that out one way or another, so users aren't surprised when their front end doesn't look like what they built in the editor. |
@idea--list Pretty sure those column issues were because of an error in the CSS. So that actually needed "fixed".
I disagree a little. This seems like a perfect candidate for As asides to the margin issue @kjellr brings up here:
|
I think it sort of has, but I also think it may be worth revisiting, because it's slightly complicated. For example, theme.scss gets loaded into the editor regardless of whether the theme has opted in, which is why moving the margin there won't bring the frontend and backend in sync unless the theme opts in. At the same time, it's probably not as simple as just not loading theme.scss into the editor unless the theme has opted in, because then numerous aspects will simply look completely unstyled in the editor for old themes, and it is still an editor after all. But it should boil down to this:
Stepping back for a minute, and looking at the current state of things, how would we change things? Keeping in mind, and correct me if I'm wrong, the two high level goals we want to solve are these:
Strawman question: themes can opt in to opinionated styles. Should themes also be able to opt out of opinionated styles in the editor? |
I am definitely for a possibility to opt out. Even nicer would be to implement a notification if GB does opt in automatically and tell people how to opt out in case the opinionated styles just do not have the desired effect. This might be a very different approach, but what if: |
As a theme dev, I'd like for the ability to opt out of If themes can opt out of opinionated styles in the frontend, and if the block editor is supposed to be WYSIWYG as it has been marketed, then themes should be able to opt out of opinionated styles in the editor in order to preserve WYSIWYG. |
This was discussed by the Design Team in today's slack triage. Can this be tested further with themes that don't have Gutenberg styling to verify this is still an issue? |
Not sure if it helps, but just tested with a very old theme and there's no margin between two consecutive media and text blocks. |
Perhaps instead of adding margins on the frontend we should remove the extra spacing from the editor? |
That's what this PR did, and there's some great conversation there: #22208 — as with all things, it's not as simple as it might seem. |
@jasmussen so what do you think the path forward here, should we just close this issue for now? |
Ultimately I think no margins is the best approach, but I also don't think we can do that as things exist today. I would hope that perhaps Global Styles could help enable the status quote to continue existing, but for themes to still zero it out. In the mean time, if Media & Text is a challenge, we could make an exception like we did for groups in #22209 (review). What do you think? |
I'm not sure I have the full picture here personally to give the best answer. Having control over this in theme.json seems like a good option (the margin needs to become a style of all blocks for that) but I can't speak about Media & Text. |
Just to confirm, the suggestion here is to zero out the margins for Media & Text blocks in the editor, so that they match the front end by default? (If so, I think that makes sense as an initial step — we might as well make things consistent for now.) |
Block themes: The spacing is now equally large in the editor and front thanks to the block gap. Classic themes without theme.json: The difference is still visible. I think we may run into backwards compatibility problems with classic themes that have made up for this by adding their own styles. Is changing this margin still something that we want to do? |
Let's close this, there has not been any discussions for over a year. |
Currently, if you're using a theme that does not provide front-end styles for the Media & Text block, you'll see this in the editor:
... but something like this in the front end:
It seems a bit jarring to completely remove the bottom margin on the front end here. Something similar happens with a number of other blocks: Cover, Group, etc.
This isn't just an issue We used to provide some bottom margin for the Cover block, but we don’t anymore in the latest release (@jasmussen can correct me if I'm wrong, but I believe this happened in #14407). I don’t believe the Media and Text block did ever ship with bottom margins.
In any case, I know we’re purposefully trying to avoid adding styles like that bottom margin so we don’t provide too much “bloat” to for theme authors to have to override… but this actually does a disservice to pre-Gutenberg themes, since they obviously wouldn’t include margin styles for these sorts of elements that didn’t exist yet. Hopefully there's some sort of middle ground.
So — I'd like to reopen the discussion around providing front-end bottom margins to blocks like these which may not come with them by default.
The text was updated successfully, but these errors were encountered: