Skip to content
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 Grid: Fix vertical alignment, round 2 #254

Merged
merged 2 commits into from
Dec 17, 2021

Conversation

jasmussen
Copy link
Member

Alternative to #252. Fixes #250. A few things going on:

  • You can colorize column background colors.
  • You can vertically align the contents of columns.
  • Margins collapse.

Together these present a bit of a challenge; if we wanted a full height colored background for a column with text bottom aligned, then it would have to be a flex container, as #252 does. But that breaks margin collapsing.

It seems we've supported full height columns, but never for an alignment other than top (please correct me if I'm wrong). And so the smaller fix in this PR adjusts the rules for that to match, and cleans things up a bit.

Site editor before (vertical alignments didn't work):
Screenshot 2021-12-16 at 12 12 20

Site editor after (vertical alignments work, and columns are full height when top aligned):

Screenshot 2021-12-16 at 12 07 46

Post editor and frontend also work the same:
Screenshot 2021-12-16 at 12 07 52
Screenshot 2021-12-16 at 12 07 58

In fixing this, I've noticed a few regressions with the appender and the inspector which I'll follow up on separately.

@jasmussen jasmussen added the Bug Something isn't working label Dec 16, 2021
@jasmussen jasmussen self-assigned this Dec 16, 2021
Copy link
Member

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @jasmussen, that's done the trick!

This is working nicely for me in the post and site editors, and on the front end. Top vertical alignment stretches the full height of the container, and middle and bottom alignment just to the height of the content:

image

I haven't been able to fault it on my test site, so LGTM! Just left a couple of tiny notes about whitespace in the style.scss diff 🙂

@@ -168,7 +168,8 @@
/**
* Parent column alignment
*/
.wp-block-jetpack-layout-grid {

.wp-block-jetpack-layout-grid {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiniest of tiny nits: there's added whitespace at the beginning of this line

@@ -185,9 +186,12 @@
/**
* Individual column alignment
*/
.wp-block-jetpack-layout-grid-column {

.wp-block-jetpack-layout-grid-column {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiniest of tiny nits: there's added whitespace at the beginning of this line

@jasmussen
Copy link
Member Author

Your review was excellent, thanks so much.

I'll try and keep an eye on any feedback around the columns not being full-height when vertically aligned; but since that's arguably been entirely broken until now, I don't expect a ton. I'll land this one, look at another quick fix, and then hopefully we can make a release. Thanks again.

@jasmussen jasmussen merged commit 162dbc1 into master Dec 17, 2021
@jasmussen jasmussen deleted the try/fix-vertical-alignment branch December 17, 2021 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout Grid: column vertical alignment doesn't work in preview
2 participants