-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Fix inconsistent dimensions during selection #67507
base: trunk
Are you sure you want to change the base?
Image Block: Fix inconsistent dimensions during selection #67507
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I wanted to note that #68666 also fixes the issue from my testing. While that PR is a lot bigger it also fixes other issues so I think we can wait to see what happens with that before deciding on what to do here.
.components-resizable-box__container { | ||
max-width: inherit !important; | ||
max-height: inherit !important; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a very smart fix 👏. With some quick testing it seems to work without causing other issues. The only thing I see wrong with it is that the ruleset should go in the editor.scss instead of style.scss because this is an editor specific ruleset (.components-resizable-box__container
is non-existant on the frontend). There’s already the selector for this too:
.wp-block-image .components-resizable-box__container { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @stokesman for the suggestion.
You are correct that changing this ruleset is better suited to the editor styles. I have moved the styles in editor.scss
3ad4141
to
77e104b
Compare
Fixes: #67506
What?
Fixes inconsistent image dimensions in the Image block when selecting and deselecting the block. The image no longer changes size when interacting with it in the editor.
Why?
Currently, when selecting an image block, the dimensions temporarily change upon selection and deselection, causing an unwanted flickering effect. This creates a poor user experience and makes precise image sizing difficult. The issue occurs because the resizable container's dimensions are not consistently maintained across different interaction states.
Testing Instructions
Add a row or stack block to a page or post
Insert an image block within the row or stack.
Select the image block.
Observe any unexpected size changes when the image is selected.
Here's the pattern ( add an image to it )
Screencast
Before:
Screen.Recording.2024-12-03.at.09.10.28.mov
After:
Screen.Recording.2024-12-03.at.09.30.15.mov