-
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
Layout: Re-instate alignwide and alignfull in flow layout get alignments #43502
Layout: Re-instate alignwide and alignfull in flow layout get alignments #43502
Conversation
Size Change: -13 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
On second thoughts, this PR is probably not the right fix for this issue as it really just hones in on the Post Template block's peculiarities and the direct children's alignwide / alignfull behaviour. We also need to factor in what to do about unmigrated blocks like the individual Column block and its children, and the conditional display of contentSize and wideSize controls in the UI, particularly for blocks that already content sizes set. I'll leave this PR open for the moment, but I imagine we'll likely close it out in favour of an approach that works across other blocks. Test block markup for column block (replace the image after inserting and note that the Image block can't be set to wide width): <!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>jlkhjklhkjlh</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column {"layout":{"inherit":true}} -->
<div class="wp-block-column"><!-- wp:heading -->
<h2>jhghkjgjh</h2>
<!-- /wp:heading -->
<!-- wp:image {"id":155,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="http://localhost:8888/wp-content/uploads/2022/08/flowers01-1024x768.jpg" alt="" class="wp-image-155"/></figure>
<!-- /wp:image --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @andrewserong!
The issue with Column is its edit function neglects to pass its layout info to useInnerBlocksProps
. If we change that, this fix will work for Column too. Testing with version 13.9.0 of the plugin shows Column children don't get wide/full align options, so it's a preexisting issue.
Let's get this fix in and then we can look at Column separately!
724f661
to
8399921
Compare
Thanks for reviewing! Yes, let's look at the Column block separately, then 👍 I've just given this a rebase to see if that helps any with getting the e2es passing (looks like it was just one of the recent flaky tests that was failing, but 🤞 we can get them passing). |
What?
Try re-instating wide and full alignments in
getAlignments
in theflow
layout if contentSize or wideSize is present in the layout object.Existing blocks that already have
contentSize
orwideSize
set in the layout object appear to still need to have this logic in place in order to be able to correctly render out thealignwide
oralignfull
classname within the site editor.Why?
This resolves an issue with the Post Template block not rendering the wide width in existing templates in the site editor, where that block is rendering correctly on the site's frontend.
How?
Re-instate a few of the lines removed in #42763. This should hopefully fix the issue without unintentionally exposing wide / full controls where we don't expect them.
Testing Instructions
Use the following block markup at the root level in the site editor:
Test markup
With this markup applied, observe how prior to this PR, the contents of the Query loop are rendered in the limited width of
contentSize
as opposed to wide width. However, on the site's frontend, thealignwide
classname is applied to the post template'sul
element.With this PR applied, it should be rendered in wide width. If you inspect the markup in the site editor, the
ul
element should now have thealignwide
classname.Screenshots or screencast