Image block: Aspect ratio not responding when dimensions are not set. #66175
Labels
[Block] Image
Affects the Image Block
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
I discovered this one when working on a pattern for Twenty Twenty-Five.
When adding images in a pattern, it's likely that the dimensions (width and height) are not set. For example:
The code shared above will try to use a "squared" aspect ratio, which will look good in the site editor context, but when viewed in the front end, it won't respond. For the aspect ratio to work, at least in Firefox, the image's width must be set. In Chrome, it also happens when the image is narrower than its wrapper.
This affects how a pattern bundled with TT5 is viewed in Chrome, so I was wondering if we could consider shipping the fix with 6.7
Proposed solution
Setting the initial width of
.wp-block-image img
tofit-content
should address the issue.Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Screen.Recording.2024-10-16.at.17.22.20-lw.mov
Screen.Recording.2024-10-16.at.17.46.52.mov
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: