-
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 Paragraph appender layout shift (building on 66061) #66779
Conversation
I've just added this to the 6.7 board in case there's still time to get it in. I'm not sure if it's possible at this stage, but @jasmussen flagged it as a good one for inclusion if it's possible, so thought I'd flag it there. |
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. |
Size Change: -50 B (0%) Total Size: 1.82 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 can't reproduce the original issue on any browser for any post type.
But since it reduces the CSS and I can't find any regressions, here's a ✅
Trunk
:where(.wp-site-blocks) .block-editor-default-block-appender>:first-child, :where(body .is-layout-constrained) .block-editor-default-block-appender>:first-child {
margin-block-end: 0;
margin-block-start: 0;
}
This PR:
.block-editor-default-block-appender .block-editor-default-block-appender__content {
margin-block-end: 0;
margin-block-start: 0;
opacity: .62;
}
Thanks for the review @ramonjd! 🙇
Ah, I assume to reproduce we might need a template that sets the post content block to use default/flow layout instead of constrained 🤔 I'll update the test instructions. |
That was it! Thank you! Before2024-11-06.12.21.04.mp4After2024-11-06.12.21.32.mp4LGTM |
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 spinning up this PR @andrewserong and for the original work @Vrishabhsk 👍
✅ Could replicate original issue
✅ Code changes look good
✅ Logic to reset for all appenders makes sense
✅ Fixes the issue
✅ Couldn't spot any regressions
Before | After |
---|---|
Screen.Recording.2024-11-06.at.11.29.07.am.mp4 |
Screen.Recording.2024-11-06.at.11.31.10.am.mp4 |
Thanks for this one 🙏 |
* Style to prevent Layout shift when placeholder is clicked * Refactor style placement to target block-appender__content specifically * Remove no longer needed rules --------- Co-authored-by: Vrishabhsk <vrishabhsk@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org>
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: d9b166a |
Noting that this missed the final RC3 so it is not certain to be included in 6.7. I'm seeing that the WP 6.7 Design Lead @jasmussen sees this as an important PR. It will be under consideration for inclusion if possible. |
I consider this a pretty critical bug, so would definitely like to see this included. |
) * Style to prevent Layout shift when placeholder is clicked * Refactor style placement to target block-appender__content specifically * Remove no longer needed rules --------- Co-authored-by: Vrishabhsk <vrishabhsk@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org>
What?
Fixes: #65969
This PR is forked from #66061 (kudos @Vrishabhsk for the work here!)
Set the default block appender to have top and bottom margins of
0
.Why?
As discussed in #66061 and #65969, the layout rules used in the post content block means that the first and last child of the post content area will have a
0
margin at the top and bottom. The (fake) default paragraph appender therefore needs to have similar rules applied to it in order to override user agent styles that cause a layout shift when a user interacts with the default appender and creates the first block in a post or page.How?
Always apply
0
top and bottom margins on the default appender, rather than only for particular layouts.A question for reviewers: does this rule seem safe enough to always be applied? So far in testing, it seems to feel safer to me to apply this reset-like style than not.
Testing Instructions
Note: in order to test the original issue in #65969 you might need to update the single post template's post content block to use the flow/default layout by switching off "Inner blocks use content width" on that block:
Screenshots or screencast
2024-11-06.11.09.13.mp4