Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Buttons: Add variations for vertical layout #27297
Buttons: Add variations for vertical layout #27297
Changes from 4 commits
92e24f2
06b9744
a7798f7
6d50534
0dcb174
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Perhaps this className should have beenis-content-justification-start
, because "left" doesn't make sense in the vertical context, and the actual value ofalign-items
that gets set isflex-start
anyway. Same foris-content-justification-right
which should probably beis-content-justification-end
.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.
Just realized the above comment was incorrect, since I got horizontal/vertical controls confused in my head.
Anyway, there is an actual problem here, though: this class is being used to
align-items
for vertical Buttons blocks, but the class name implies it can only setjustify-content
. Additionally, thejustify-content
styles are being applied to both vertical and horizontal orientations. That's not technically correct.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.
Why not? You can have vertically stacked buttons and align them for example to the right. What do you propose exactly? If it's about the term/component names, do you think it's okay to have in a follow up PR?
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.
We shouldn't be setting
justify-content
for the vertical case... onlyalign-items
. But also, the class "is-content-justification-xxx" is kind of confusing if it's actually applying item alignment in the vertical cases. I think ideally, we'd want to tackle this stuff sooner rather than later to reduce the number of deprecations and legacy styles we have to keep on the front-end.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.
The problem here is basically that I named the
is-content-justification-xxx
classes with the assumption that they would only be used to apply differentjustify-content
styles, but that's no longer true in this case.Maybe a new class name that can work both cases would be appropriate. I'm not sure what the correct term is, though.
Or maybe the solution is to apply different classes for the vertical cases, e.g.
is-item-alignment-xxx
. I'm not sure.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.
It's worth remembering that in addition to
align-items
andjustify-content
, there's alsoalign-content
andjustify-items
, thoughjustify-items
doesn't do anything in Flexbox.By looking at how these properties work, we can learn the following about how CSS is using these terms:
In a horizontally-flowing container, "align" refers to vertical positioning and "justify" refers to horizontal positioning. In a vertically-flowing container, "align" refers to horizontal positioning and "justify" refers to vertical positioning. In other words, "justify" refers to positioning along the primary axis that content is flowing, and "align" refers to the secondary (AKA "cross") axis.
"content" applies to all the children as a single block within the container, and "items" applies to each child as an individual unit.
Technically, the kind of alignment/justification we want for the horizontal variant is actually conceptually different from the control we want on the vertical variant. Technically,
justify-content
's cross-axis equivalent isalign-content
, notalign-items
. 😖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.
If I had to come up with a better class name than what we're using right now, I guess something like
is-content-horizontal-placement-xxx
might work. I'm drawing the "placement" term here from the shorthand propertiesplace-content
andplace-items
. The CSS "placement" term is apparently its generic way of referring to both "alignment" and "justification".Of course, in my suggested class name here, the meaning of "content" is slightly different from what CSS uses it for, since in the case of my suggested class name, it can refer to either CSS's "content" or "items". But I guess it's good enough for our purposes?
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.
For me it's too late to change the class names, this is already shipped and themes might be relying on it. The renaming doesn't seem to add a lot of value.
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.
As far as I can tell, it's only shipped in the plugin, not core, right? Does that change anything?
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.
It does, we have more luxury to change things that way but are we certain of that? It's also a bit late if it's in WP 5.6 as we're on RC2 and the stable is supposed to happen next week.
We need to do a few things if we want to rename the classnames:
cc @tellthemachines