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

Image Block: Can be resized in a small viewport even though the block is wide-aligned #57003

Closed
t-hamano opened this issue Dec 13, 2023 · 0 comments · Fixed by #57041
Closed
Assignees
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended

Comments

@t-hamano
Copy link
Contributor

Description

In the large viewport, the Image block cannot be resized if they are wide-aligned or full-width. I think this is the expected behavior, since if it's wide, it will be as wide as the theme defines, and if it's full width, it will span the full width of the canvas.

However, a small viewport width allows us to resize the image even if it is wide or full width. I think this is unintended behavior.

Whether the Image block can be resized is determined by the isResizable variable below:

const isResizable =
allowResize &&
hasNonContentControls &&
! ( isWideAligned && isLargeViewport );

Please pay particular attention to the following parts of this conditional statement.

! ( isWideAligned && isLargeViewport );

Originally, this conditional statement had the following format:

! isWideAligned && isLargeViewport;

It appears that a conditional statement with the same meaning was originally added in #3344 to disable resizing on the small viewport.

I suspect that this conditional statement was changed unintentionally in #25940, when the gallery block was refactored (See diff).

Step-by-step reproduction instructions

  • Insert an Image block.
  • Apply Wide width or Full width.
  • Narrow the browser width.
  • The image should be able to be resized.

Screenshots, screen recording, code snippet

a7c9b8945c64613177b49081c10348ac.mp4

Environment info

No response

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

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels Dec 13, 2023
@t-hamano t-hamano changed the title Image Block: Images can always be resized in the small viewport Image Block: Can be resized in a small viewport even though the block is wide-aligned Dec 13, 2023
@t-hamano t-hamano self-assigned this Dec 14, 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 [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant