Skip to content

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Jul 21, 2025

What, Why, and How?

Closes #70819

This PR fixes a bug where the resize handler doesn't reset correctly after the first undo following a Cover block resize.

This occurs because the following line only checks whether minHeightUnit is set to px.

Ref:

height: minHeightUnit === 'px' ? minHeight : 'auto',

After resizing and undoing, the unit may still be px, but minHeight becomes undefined. In this case, the resizableBox height should default to auto.

Ref. of a similar condition:

const minHeightWithUnit =
minHeight && minHeightUnit
? `${ minHeight }${ minHeightUnit }`
: minHeight;

Testing Instructions

  1. Create a new post, insert a "Cover" block, and attach an image/video to it.
  2. Resize the "Cover" block.
  3. After resizing, undo the changes by pressing CMD/CTRL + Z.
  4. Confirm that the resize handler gets reset properly.

Testing Instructions for Keyboard

Same.

Screenshots

Before After
before after

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review July 21, 2025 10:30
Copy link

github-actions bot commented Jul 21, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Jul 21, 2025
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @yogeshbhutkar!

@Mamaduka Mamaduka added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Jul 21, 2025
@github-actions github-actions bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Jul 21, 2025
@Mamaduka Mamaduka merged commit b8b861b into WordPress:trunk Jul 21, 2025
71 of 74 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.3 milestone Jul 21, 2025
adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Jul 21, 2025
Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
@yogeshbhutkar yogeshbhutkar deleted the fix/handle-resizable-box-dimensions-on-undo branch July 22, 2025 10:42
USERSATOSHI pushed a commit to USERSATOSHI/gutenberg that referenced this pull request Jul 23, 2025
Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Block] Cover: Resize handler does not properly reset on undo (Ctrl/Cmd + z)
2 participants