Skip to content
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

Drag to resize image doesn't maintain aspect ratio when constrained #55624

Open
ajlende opened this issue Oct 25, 2023 · 1 comment
Open

Drag to resize image doesn't maintain aspect ratio when constrained #55624

ajlende opened this issue Oct 25, 2023 · 1 comment
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

Comments

@ajlende
Copy link
Contributor

ajlende commented Oct 25, 2023

Description

Dragging to resize an image sets the CSS width and height, so when the image is constrained by max-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 and height are set, the aspect ratio may need to be computed so that the image can be scaled down with max-width instead of stretched/cropped.

Step-by-step reproduction instructions

  1. Add an image block with an image.
  2. Use the handles on the image to resize (not the inputs in the sidebar).
  3. View the image in the frontend in a context where max-width would constrain the image (a narrow window)

Screenshots, screen recording, code snippet

Editor after scaling down the image a bit:
image

Front-end:
image

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

@jordesign jordesign added [Type] Bug An existing feature does not function as intended Needs Testing Needs further testing to be confirmed. [Block] Image Affects the Image Block labels Nov 5, 2023
Copy link

github-actions bot commented Dec 6, 2023

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Dec 6, 2023
@ajlende ajlende removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants