-
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
Fix horizontal flex layout in classic themes. #60154
Conversation
Size Change: +373 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
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.
I just learned that the problem reported in #60078 also occurs in the grid layout:
The selector changed in this PR only excludes flex layout, but the lower CSS specificity also solves the grid layout issue:
If we do not want to apply this margin style itself even when using the grid layout, how about updating the selector as shown below?
:where(.editor-styles-wrapper) :where(:not(.is-layout-flex):not(.is-layout-grid)) > .wp-block
Or how about simply reducing the specificity without considering any particular layout?
:where(.editor-styles-wrapper) .wp-block
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Tested in a few classic themes with all Group block manifestations. Justification works as expected in the editor (it didn't before)
Before | After |
---|---|
![]() |
![]() |
If we do not want to apply this margin style itself even when using the grid layout, how about updating the selector as shown below?
I also tested @t-hamano's suggestions, e.g., :where(.editor-styles-wrapper) .wp-block
and they appear also to work.
Thanks for the reviews, folks! Good point about the grid layout @t-hamano. I'll update the selector to include it, as that will allow us to reduce layout selector specificity later. |
Co-authored-by: tellthemachines <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: ramonjd <[email protected]>
Co-authored-by: tellthemachines <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: ramonjd <[email protected]>
This PR introduces the issue, Automattic/themes#7749 🥲 |
What?
Fixes #60078.
The selector adding auto margins to all blocks in the classic stylesheet (only enqueued for classic themes) is overly specific and targets blocks too broadly. This PR reduces the selector specificity and changes it to not apply to direct children of flex blocks.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast