Skip to content

Conversation

@thexavismith
Copy link

What?

Removes the height: auto CSS that is currently overriding the height value in the editor.

Why?

This issue was originially reported in the WP Calypso repo, but it was determined that the fix needed to be here: Automattic/wp-calypso#61744

How?

This PR only applies height: auto if both width and height are set to preserve the aspect ratio.

Testing Instructions

  1. Create a post or page
  2. Add an image and edit both the width and height
  3. Verify that the CSS recognizes this and adds height: auto to preserve aspect ratio on the frontend
  4. Add an image and edit just the height
  5. Verify that the image on the frontend is the size set but with a preserved aspect ratio

Screenshots or screencast

CleanShot 2022-05-09 at 15 13 53@2x

@thexavismith thexavismith requested a review from ajitbohra as a code owner May 9, 2022 22:14
@github-actions
Copy link

github-actions bot commented May 9, 2022

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @smithtimmytim! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label May 9, 2022
@skorasaurus skorasaurus added the [Block] Image Affects the Image Block label Nov 20, 2022
@Mamaduka
Copy link
Member

Mamaduka commented Aug 4, 2025

Thanks for contributing, @thexavismith!

I can no longer reproduce the bug. I believe this was resolved in recent WP versions when aspect-ration controls were introduced. Ref: #52286.

I'm going to close the PR.

@Mamaduka Mamaduka closed this Aug 4, 2025
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 First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants