-
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 pattern preview expanding height and scrollbar issues #38175
Conversation
Note: As a future follow-up, we might want to review |
Size Change: +78 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
WP Version: 5.9-beta3-52380
Conclusions: Screen.Recording.2022-01-24.at.11.08.21.mov |
if ( styles ) { | ||
return [ | ||
...styles, | ||
{ css: 'body{overflow:hidden;}', __unstableType: 'presets' }, |
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 left a comment over here, but just wanted to make sure you see it: #37573 (comment)
I think if we need to override a style in the iframe, it'd be good to also do something like height: unset
, the reason being that height: 100%
is what's causing the scrollbar for patterns.
I'm not sure if you also need overflow:hidden
to fix the other issue. It seems ok in conjunction with overriding the height, but just overflow:hidden
on its own causes patterns to be cropped unnecessarily.
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.
Here's a comparison to show what I mean:
Just overflow: hidden
on the preview body:
height: unset
and optionally overflow: hidden
on the preview body:
It's subtle, but you can see for the second one there's the correct spacing at the bottom of the preview when unsetting the height. My concern is that some patterns may be more affected than others by this effect.
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, @talldan.
Added the rule to unset height.
Thanks for the video, that's helpful. I want to note I've seen that issue separately from the patterns panel, occasionally in the block inspector as well, so although a frustrating issue, I believe it's a separate one. Can you reproduce that one on trunk as well? In my past experience, the issue "goes away" by simply making the browser taller or shorter. |
Thanks for testing, @c4rl0sbr4v0. That might not be related to this fix. I've seen a similar issue before. Unfortunately, we can fix everything an hour before RC4. Can you confirm that PR fixes the original issues? |
Thank you, @ixkaito. Do you mind opening a new PR against trunk? We won't be able to ship it with WP 5.9, but if it works, it would significantly improve the plugin |
Thank you @Mamaduka ! Of course. I'll do it. |
I re-sent the PR to trunk. Please check it. #38181 |
* Apply a 99vh max-height to the thumbnail. * Polish * Apply pixel based max-height. * Don't apply overflow auto to all iframes * Memoize editor styles * Remove no need for iframe changes * Unset height * Apply max-height to container * Update max-height Co-authored-by: jasmussen <[email protected]>
…38182) * Apply a 99vh max-height to the thumbnail. * Polish * Apply pixel based max-height. * Don't apply overflow auto to all iframes * Memoize editor styles * Remove no need for iframe changes * Unset height * Apply max-height to container * Update max-height Co-authored-by: jasmussen <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: jasmussen <[email protected]>
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. git-svn-id: https://develop.svn.wordpress.org/trunk@52633 602fd350-edb4-49c9-b593-d223f7449a82
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. Built from https://develop.svn.wordpress.org/trunk@52633 git-svn-id: http://core.svn.wordpress.org/trunk@52221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. Built from https://develop.svn.wordpress.org/trunk@52633 git-svn-id: https://core.svn.wordpress.org/trunk@52221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. git-svn-id: https://develop.svn.wordpress.org/branches/5.9@52634 602fd350-edb4-49c9-b593-d223f7449a82
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. Built from https://develop.svn.wordpress.org/branches/5.9@52634 git-svn-id: http://core.svn.wordpress.org/branches/5.9@52222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. Built from https://develop.svn.wordpress.org/branches/5.9@52634 git-svn-id: https://core.svn.wordpress.org/branches/5.9@52222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Just testing in RC4, still a lot of issues 😢 This PR was definitely an improvement though, most noticeably in Gutenberg itself, but there seems to be a larger issue with regards to the way WordPress handles stylesheet concatenations. I am also still seeing some scrollbars so maybe we should keep #37573 open 🤔 |
Like @ndiego I've just tested with RC4 without the Gutenberg plugin active and the issues are still present. I used our Aino theme but the 2022 gives a similar experience. The scrollbars are gone, but the height of the patterns is not displayed correctly (some are too short, some stretch longer than the actual height. So now for the short ones no preview is possible at all, see: |
Thanks for testing, @ellenbauer. @ndiego or @ellenbauer, do you mind creating a new issue? I will add to the 5.9.1 milestone and re-post the technical findings of the problem so far. As Nick mentioned, the way WP handles stylesheet concatenations can cause different results. Currently, we can't reproduce the same environment via the plugin. |
@ellenbauer Do they still get cut off if you're not loading extra styling from your plugin? |
I'm seeing the same experience with utility styles that are added with Extendify. If I don't have those loaded, then the scaled previews are generated in time for the height to not be cut off. |
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. Built from https://develop.svn.wordpress.org/branches/5.9@52634
This merges the latest package updates for the block editor to include the fix for WordPress/gutenberg#38175. Props hellofromTonya, mamaduka, joen, talldanwp, cbravobernal, poena. Fixes #54487. Built from https://develop.svn.wordpress.org/branches/5.9@52634 git-svn-id: http://core.svn.wordpress.org/branches/5.9@52222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Description
Resolves #34729
Resolves #37573.
Description by @jasmussen
This PR fixes the scrollbar shown inside thumbnails and applies a bandaid to stop
vh
based patterns from endlessly expanding.In testing, it became clear that 100vh equals the height of your browser. Inside an iframe, things are different. This StackOverflow question led me to this spec note:
That seems to suggest it’s very easy to create a race condition, as “initial containing block” can’t be properly sized until content inside is loaded.
Because of that, this PR applies a pixel based max-height. A tall one, and one that will let the VH based pattern scale until it reaches that max-limit, but nevertheless it should mitigate the issue.
As noted in comments in the code, a better fix might be apply a max-height based on the initial-content height. But due to the iframe scaling behavior, this seems nontrivial
How has this been tested?
I tested with TT2, Blockbase, and Blank Canvas themes. The "vertically expanding" issue was most visible with Blank Canvas.
Screenshots
Try similar testing method with different Classic and Block themes.
Types of changes
Bugfix
Checklist:
*.native.js
files for terms that need renaming or removal).