-
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
Page/Post editors: When template has "Inner blocks use content width", editing looks broken #52163
Comments
The question here is what "layout" to apply in the post editor. Initially we just used to apply the "layout" from "theme.json" but I believe this was changed at some point to try to load "post content" block from the template and "guess" the layout from that to closely match the frontend config. It seems what we want is something like that: 1- Fetch the "layout config" from the post content block. Is this your expected behavior @jasmussen ? |
@jasmussen For the "on"/"off" state of the toggle I agree but what about the "content width" and "wide width". Do you expect the widths to either:
|
Right, I'd definitely lean towards theme.json values for post and page editors! |
@jasmussen I think that's the previous behavior, it has been changed at some point but I agree that even if it's not perfect, it makes for a better default behavior and it's also more performant because there's no need to introspect the post content block. |
One thing to consider with making changes to the logic is that some of the current behaviour was introduced due to folks intentionally having full-width templates, e.g. the issue in #51371. So it sounds like there'll likely be a trade-off over which defaults we prioritise for? Overall though, ensuring usability within the post editor, even if it doesn't directly match the site frontend, sounds like a good goal to me. |
I know that @SaxonF and @jameskoster have had some thoughts around "editor unification" in terms of optionally showing template properties and more in the post and page editors, so there's an opportunity in the future to do that in a coherent way. As it is implemented today, however, I would argue the use case in 51371 is best handled by editing those pages in the site editor. As is, we have made the writing flow for just updating posts and pages very poor for a great deal of themes, to account for what is arguably an edgecase. |
I think that's a good way of putting it — it can sometimes be tricky to figure out which is the dominant use case and which is the edge case. I believe an assumption was probably made that most themes would likely be using constrained layout for the post content block, rather than intentionally setting the block to full-width and then constrain via a two-column layout in themes. I agree with the discussion here — to prioritise the writing flow for posts and pages. I imagine we'll likely need to keep in mind that once we make subsequent changes, there could be some feedback from folks who flag it as a breaking change for their particular sites, but on balance I think it sounds like a good idea. |
Hmm, not necessarily. If the intent is for Post Content to be aligned to the left hand side of the second column, the layout justification controls already allow that. In this case, it would still be useful for Post Content to have "inner blocks use content width" so that the text doesn't become illegibly wide on a large screen. It's a valid point that the post editor view doesn't take the full template structure into account, so we can never be sure if edge-to-edge text really is the desired outcome, and I agree it's likely not the desired outcome for most cases. What is the preferred solution though? A minimum margin around the editor so nothing bumps against the sides, or a maximum content width (with the content centered)? Or both, to take small viewports into account too? |
Honestly, any small patch that restores the center column we had before. Even if the intent of having some synchronicity based on the behavior is good, the previous behavior was better. But Riad's suggestion here seems good. |
I uncovered this behavior recently and thought it was a layout bug (as reported in #60311). I expected the editor and front-end layout values to always reflect 1:1. 😅 Maybe the "post" post format is fine to assume contentWidth intent; but certainly for pages we can't assume. |
This recently regressed, so reopening. |
To add more context, this is mainly/only about the abstracted editor, when "show template" is toggled off, which it is by default in the post and page editors. You should never see a content column that goes left edge to right edge. |
Thanks for re-opening @jasmussen! Here are a couple of previous PRs from last year:
If I'm following those PRs correctly, the logic from those PRs was:
So I agree, it sounds like somewhere along the way this has regressed. I wonder if it broke somewhere during the editor unification efforts? FYI: @tellthemachines in case you remember if there were any other relevant changes since those above. |
@jasmussen are you able to provide reproduction steps? The markup for the template your using could help give some clues here to hone in on the logic and whether there's a fresh bug, or something unique to the template you're working with. In my testing so far, it seems that the feature of using the fallback layout is working okay for me if the post content block switches off content width, but does not have full width alignment set:
If I go to set the Post Content block to have full width alignment, then the CSS rules for full width alignment on the content block take precedence over the fallback layout:
In the latter, we can see that the content width is intended to be used, but is being overridden by the editor's styling for full width content blocks: That rule is set here:
As far as I can gather from the code comment on that rule, the expectation (from the editor's perspective) is that if the Content block has full width alignment set, that it's really full width. Can you please confirm:
I see that TT5 theme sets align to full within its If it's that template that's causing the issue, there's potentially a couple of options:
Hope that all made sense, I find it very tricky to write about this feature as it's quite nuanced and there's a fair bit of logic and existing decisions captured in the current state of the code. Let me know if there's anything else that needs digging into here! |
Not sure what's up, but I see this consistently in Twenty Twenty-Five, in one of the alternate non-default templates optimized for photos. Here's the Single template: Here's how the post editor looks: As you can see, there's no semblance of WYSIWYG between the abstracted post editor and the actual with-template appearance. Here's the single template markup:
Let me know if I'm missing nuance! |
Thanks for following up!
Ah, this took me a little while to find as I had to go to create a new template and then select a pattern in order to have access to this particular template. I can see it now. I think a simple solution might be for us to avoid outputting the I'll open up a draft PR and we can give it a test and see what we think! |
I've opened up a PR over in #66352 that tries a solution for this. It'll likely need a bit of wider feedback as the approach (and discussion) here is a little different to the feedback in #60311 which was sort of the opposite view to this issue. But it's a PR for us to play with — happy to either proceed with it or toss it out if there's a better way to handle things! |
I'm tentatively closing this per the reasons given in this comment, essentially that what I was seeing was an edgecase that could/should be fixed separately. That PR may still be relevant to merge in case it addresses that edge-case, but this issue as originally reported was not entirely accurate. Thank you all for looking. |
Consider the following Page template layout, which features the Post Content block inside a 2-column setup, where the columns block applies proper padding to ensure that things are nicely spaced out:
Note in this case how the Post Content block has the option, "Inner blocks use content width" unchecked. As a result of this option being unchecked, the regular page editor looks entirely broken, with an unbounded main column and no padding:
This layout is entirely buggy and is not a good experience.
Going back to the Page Template, if the "Inner blocks use content width" option is checked, the final site layout would look incorrect due to the intent of the 2-column setup:
However when this option is enabled, the page editor looks usable again, with its trademark center column for content:
Here's a GIF showing toggling and untoggling, and its effect on the page/post editors:
In other words, it seems like the unbounded page and post editors were intentionally made to unbound their main column when Post Content has this property toggled or untoggled. The net result is a very buggy post/page editor experience. Perhaps the intent was to be closer to WYSIWYG, but so long as the container that surrounds the Post Content blog is omitted in page or post editors, it will never by WYSIWYG, it will only ever be broken. So until that can be the case, post and page editors should not be affected by the Inner blocks/content width property.
The text was updated successfully, but these errors were encountered: