-
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
BlockPreview: Patterns with VH units scale oddly #50449
Comments
I guess there's a feedback loop going on here:
When one changes it causes the other to change, which in turn causes the other to change and so on. It might be possible to limit how much the iframe updates its own height, but that could also cause some legit height changes to not happen. The height update could also be throttled, but that would just slow down the amount it expands 😄 Definitely an interesting one! |
Seems related to #38181. I don't think this issue is solvable with iframe, since the iframe height is always Another quick fix I can think of is to acknowledge that some patterns can't be shown fully in a preview and instead render a sort of "more below" indicator at the bottom. Something like... This is obviously not the final design but just a mockup of an idea. I can put up a draft PR and let anyone interested play with the design to find a better balance. |
Would |
If it's only a single element with This is also the case for the pattern shown in the video of this original issue. IIRC, it has a height of |
I think this move is irritating to users. How about removing the transition CSS |
In my opinion, we should set a max height to the preview, perhaps at the same ratio of the viewport height based on the width of the preview. There are previews that are taller, but then the rest of it will appear "under the fold" as it would appear on the front-end and in the editor? That seems reasonable to me. |
We already set a max height to the preview, currently it's hardcoded to
Could you elaborate what you mean here? Do you mean the ratio of the current users' browser viewport? |
Yes :) I think we should make the ratio the same. The downside is that you cannot preview "under the fold", but that seems reasonable to me. It's just a preview. |
I agree. |
Yep, and it's already the case. I don't think the issue is even solvable as per #50449 (comment). Any block that has height > |
I implemented #50449 (comment) (IIUC) in #54285 so that we can see it in action. Let's discuss there if that's the approach we want to take at this stage. |
I misunderstood the "under the fold" bit. I wasn't thinking that it was connected to your direct viewport, but a viewport size of the preview itself. If we have a max height on those, and the rest is runoff, that's fine (basically like how patterns in the "Choose a pattern" modals work). |
The same bug was reported on Trac here. From the report:
|
In #56806 we discovered this bug also happens in the experimental Zoomed Out view in the editor canvas. |
An issue with the zoomed out view was resolved by #59334. I'm wondering if a similar approach could be applied to block previews as well. |
The difference with the preview is that it doesn't have a fixed viewport height (expands based on content). For zoom out mode we keep the same viewport height and scale the html element inside the iframe (I removed the expanding). So the only fix would be to set a fixed max height to the previews? |
Do we do this for block previews anywhere already? I recall perhaps within the starter patterns modal, or templates view? |
I added a couple new patterns as core patterns, one of which uses the
vh
unit to set the height of a Cover block. This causes the pattern's BlockPreview to continuously expand in height, resulting in an oddly displayed pattern.CleanShot.2023-05-08.at.17.05.40.mp4
Related in part to #43865. And the same issue occurs in the Site Editor's Zoomed Out mode, as indicated here: #49299
Thoughts on how we can resolve this?
The text was updated successfully, but these errors were encountered: