Drag to resize image doesn't maintain aspect ratio when constrained #55624
Labels
[Block] Image
Affects the Image Block
Needs Testing
Needs further testing to be confirmed.
[Type] Bug
An existing feature does not function as intended
Description
Dragging to resize an image sets the CSS
width
andheight
, so when the image is constrained bymax-width
such as in TT3 the aspect ratio is no longer maintained. (see screenshots)This could be solved by only setting only one of the dimensions to constrain the image. I'd expect dragging the bottom handle to set the height and the right handle to set the width potentially.
When both
width
andheight
are set, the aspect ratio may need to be computed so that the image can be scaled down withmax-width
instead of stretched/cropped.Step-by-step reproduction instructions
max-width
would constrain the image (a narrow window)Screenshots, screen recording, code snippet
Editor after scaling down the image a bit:

Front-end:

Environment info
I can recreate this with TT3 and WordPress 6.3, and TT3 and Gutenberg v 16.4.0.
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: