-
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
Gap on columns block is hard-coded with a fixed value #41431
Comments
Side note: Column is weird overall, is set to flexbox but has no flex-direction. We are currently investigating, just a hint for others if their sites look broken from the last update. |
If no |
That makes no sense for column blocks imo. |
Column or columns? |
single column |
Using WordPress 6.0, the |
Ok, thanks for the clarification. I get classes like "wp-container-44" on my blocks. I don't know if those come from the Gutenberg plugin or from another plugin. At least with your info I can check further. Display block, good to know. ty |
They come from WordPress core and/or the Gutenberg plugin, but they don't always apply flexbox rules. |
The addition of a css var to set the default could maybe be considered as part of this work which adds a css var for the gap in a similar way to the gallery block. |
Thanks for linking to that PR. I'm not sure it addresses this enhancement request because, while it does create a new CSS var to house the columns block gap spacing value Not to say we can't extend it's usage, but it's not the subject of that PR right now. Having said that, #41123 is a bit iffy in that it's pending discussion on suitability, so one could extract the code to achieve the effect I think this PR asks for 🤷 |
Just adding a bit of background / context surrounding using fixed values for block spacing / gap instead of CSS variables. The shift away from using CSS variables for gap was started in #37360 to resolve subtle issues of conflicts between blocks (and cascade) when using CSS variables for the gap value. More recently, a refactor of the Layout support has been merged (in #40875) which now allows the Columns gap to be set at the block level in From reading the discussion on this issue and #42333, it sounds like the issue here is wanting a way to opt-out of the fallback gap style altogether. Is that correct? I've linked to this issue in the layout tracking issue (#39336) — one of the tasks is to come up with a way for themes to explicitly opt-out of each part of the Layout support, one of which could be opting out of fallback gap styles altogether. If themes were to do that, though, they'd then be responsible for providing their own styling for any blocks that rely on the Layout support (so not just Columns, but also Social Icons, Buttons, etc). I imagine many classic themes would probably expect to be doing that, though. If anyone feels strongly about how themes should be able to opt-out of gap styles, please share your ideas! I'm planning to try out a couple of options, but would love to hear if folks already have ideas about how they think it should work. Thanks! |
Thanks for the explanation @andrewserong. The rabbit hole on this is too deep to follow; there are so many open, partially-merged and as yet unaddressed issues with core CSS, inheritance and specificity that it's all but impossible to debug until the next resolved version lands in public core. It's currently impossible to know what the next release will contain, and which of the many CSS problems it will resolve. Aside from any technical discussion, the goal for this Github issue is that developers need to adjust the default block gap on columns, media text etc. using values in the theme - either through theme.json or directly in CSS - and also to be able to override them on a per-block case. (e.g. adding an editorially-selectable block style “wide gap” which then amends the gap size on that individual block. The |
I hear you! There's a lot of parallel work going on, and it is hard to follow. Given that so much work is in progress, then, it might be worth it to review how much of these issues are addressed, and what still needs tweaking when we reach the beta phase for WordPress 6.1. It looks like the next release should include quite a few improvements that will hopefully addresses these issues, while allowing more flexibility and control.
This is now possible in In terms of additional Layout features (and exploring options for switching off / opting-out of Layout), I'll continue to post updates over in the layout tracking issue in #39336 🙂 |
Thanks again @andrewserong. I'll certainly look into the Layout controls when 6.1 become publicly available. There have been issues with CSS specificity problems which are blocking theme developers from overriding inline styles - specifically #40159 - which I'm hoping are resolved by the upcoming improvements. |
Thanks for linking through to that issue, I've added that one to the layout tracking issue, too (#39336). I believe the current work should help progress that issue, too, in that base layout styles should wind up having lower specificity, and be easier to override (with less reliance upon inline styles/classname unless there is a "real" inline value). But again, will be good to test once we get closer to the Beta / RC stage 🙂 |
@andrewserong Following on from @grappler's comments on #40875 (comment): it's come to light that leaving Setting The initial issue of overridability remains for now. |
Thanks for following up @markhowellsmead:
This area gets pretty nuanced, so I just want to make sure I understand the issue here. If you're setting
That's a great point — I wonder if it's possible for us to come up with a rule that when the fallback gap is in use, we use a lower-specificity selector (e.g. attached to |
@markhowellsmead alternately, I have an open PR in #42544 that proposes adding a theme support |
Current status with Core 6.1.1 is that the default gap on the columns block can be overridden by |
Thanks for confirming @markhowellsmead! Since that gives folks two potential avenues to overriding the default column gap, I'll close out this issue now. Please feel free to either re-open, or create a new issue if there are follow up tasks you'd like to raise. Thanks again for all the discussion here. |
Description
The inline CSS uses
gap: 2em
instead of a CSS custom property.See also #41015 (comment) and #41423
Step-by-step reproduction instructions
Add columns block to the page and inspect the flex gap property.
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: