-
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
Cover block not working when changing the aspect ratio #60224
Comments
Thanks for opening this issue @westnz! I've added it to the tracking issue for follow-up tasks over in #58230
Unfortunately this is a limitation of using aspect ratio with the Cover block. When using an aspect ratio, the aspect ratio is preserved even if text extends beyond the bounds of the block. There was some initial discussion about this on the original PR (#56897) and more recently on a Cover block bug fix PR (#59388) that restored the original overflow rules. I'll just ping @jasmussen, @jameskoster and @tellthemachines for visibility since they were involved in some of those discussions. In short, I think the discussion was summed up in this comment:
What this means is that for WP 6.5, when using the aspect ratio control for Cover blocks, it will preserve the aspect ratio at all screen sizes. This makes it suitable for simple Cover blocks with, say, a single heading or a button, but likely not for cover blocks containing paragraph-like content. For future WP versions, I think it'd be great for us to explore extending the options for how overflowing content is handled: e.g. if it extends the container, if it switches off the aspect ratio, or if it displays a scrollbar, etc. Any exploration there will need to be careful to avoid regressions, as was brought up in #59388.
This is an interesting one. To work around it in 6.5, to clear out the value, you can either set a "minimum height of cover value" or go to the ellipsis menu for Dimensions and then click RESET next to Aspect ratio: What's happening on The confusion surrounding the "Original" option is also flagged in the tracking issue (#58230). To sum up: the aspect ratio support in 6.5 is in its first state, which is useful for some but not all use cases. I think it'd be good to come up with more options for how we handle overflowing content, but I doubt there'll be any solutions ready in time for 6.5. It would be a good thing to expand and enhance for 6.6, though. For the issue of switching to Original and it overriding the minimum height of the Cover block, that does look worth fixing if we can. Since it's possible for a user to reset via the ellipsis menu or by setting a minimum height of the cover block, I think it's a good idea to fix it, but IMO can wait until WP 6.5.1. |
Thank @andrewserong you very much for shedding more light and connecting all the dots. ⭐ Glad these issues are being looked at by all the right folks. |
I have been experimenting with the We use the The current implementation of The overflow issue also seems like a strange choice when it comes to |
Thanks for sharing your thoughts @eric-michel!
That was the original intention in the PR that implemented the feature. Unfortunately we ran into a bunch of issues when any width, height, or min height values were in use, where the element with the aspect ratio set would no longer smoothly reduce down in size on narrower viewports, and would sometimes break out of its container. Or, there were also situations where full width layouts broke when an aspect ratio was set. The compromise for the initial version of the support was to make the settings mutually exclusive. Longer-term, it'd be great to figure out how to make these controls play well with one another, as what you describe sounds ideal to me. If you're comfortable, would you mind sharing the custom CSS you commonly use? It could be helpful to have an example of common custom CSS to use as a guideline for further development on the feature. |
Hey @andrewserong, happy to! Here's a quick Pen I did that I think approximates how the Cover block works: https://codepen.io/ericmichel/full/oNOyBBw. The image should follow the We started doing this probably a couple years ago because using the built-in Generally speaking, I have found it to be super reliable to simply add a single-property class to any cover block with the aspect ratio defined and it just works right out of the box. Best I can tell, So for instance, I could usually get away with just adding something like:
to a Cover block and be off to the races! Interestingly, normally content breaking out of the If I had my druthers, |
Description
When I use the 6.5 Beta Tester plugin and change the aspect ratio of the Cover block, the text does not always display correctly when selecting mobile view. For example, when I select the 'wide' aspect ratio with three sentences of text, the text cuts off in mobile view. A second issue I found was that when I changed the aspect ratio back to 'Original', the block did not display correctly.
I don't have any other plugins installed, only Beta Tester. I am using Local and the Twenty Twenty-Four theme.
The expected output when changing the aspect ratio is that the text will change accordingly for mobile view and that you can revert back to 'Original'.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Gutenberg not installed - only Beta Tester plugin. I did test it with Gutenberg 17.9.0 turned on as well.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: