-
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
Post Content: Fix float clearing on entry content #35958
Conversation
// Required to ensure that subsequent blocks clear floats inside entry content. | ||
.wp-block-post-content { | ||
overflow: hidden; | ||
} |
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 there's an issue with using hidden
here, an alternate solution would be to do something like .wp-block-post-content + * { clear:both }
. The 'hidden
approach seemed a little more predictable though.
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.
What about overflow:auto
? I prefer that as its less likely to cut off things by mistake...
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.
Yeah, that's probably safer. Updated in f29e0c4.
Size Change: +106 B (0%) Total Size: 1.07 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.
LGTM
This change had some unintended side effects. Any content that breaks outside of the boundaries of the post content block, whether intentionally or otherwise, are now cropped and a scrollbar appears. In this example I'm testing a navigation submenu which painly gets cropped: Overflow is a bit of a risky property to change, so I would honestly suggest this be added to the theme instead of the block editor itself. I can think of a bunch of creative layouts, especially with negative margins in the future, where this will cause breakage. |
Thanks, I figured we missed something. 😅 @jasmussen do you think |
Potentially! Feels worth a shot. And I do think it's okay to try and fix here, but mostly we should avoid touching overflow, in my experience that always comes back to bite. |
If the last item in post content is a floated element, items below post content will incorrectly flow in next to it.
To test:
clear:both;
, and don't have this issue. Twenty Twenty Two's page templates work for testing.)Screenshots:
Related: WordPress/twentytwentytwo#44