-
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 changes sizes upon selection #67506
Comments
Hey @richtabor, Thanks for raising this issue I noticed that max-width and max-height values were being reset when selecting/deselecting the image block, causing the unwanted size changes. I've fixed this by ensuring these values are consistently inherited in the resizable container regardless of the selection state. Feel free to test the patch using your pattern and let me know if you see any issues. |
So the problem occurs with the specific combo of Image inside flow/constrained layout inside flex layout, which happens if we have an Image inside a Column of a Columns block. This is because Image block has a max-width observer that is only rendered when the image is inside a flow or constrained layout and the Image block is selected. So if we deselect the Image and resize the canvas, the Image won't reflow because its max-width observer has been removed. I'm thinking we could perhaps not remove the max-width observer when the Image isn't selected, but not sure if that can have other consequences. The PR where it was added doesn't mention why that rule was added. If @kevin940726 is around he can probably speak to that 😄 |
Pretty sure that would have performance implications. Also, this reminds me of #68057. Should there simply be no max-width in certain circumstances? |
From my testing #68666 happens to resolve this. I’d appreciate anyone testing that PR and commenting there whether it resolves this.
The PR I linked didn’t have to touch this. I think the reason it resolves this is because the |
I have learned more about this and have found that a part of the issue is the max-width observer hook is getting it wrong in some cases. So even if the hook were always active and no size changes happen while editing, the editor visuals would not match the frontend. The PR I linked in my last comment resolves this issue as detailed in the OP and avoids disparity with the frontend but there are still some more obscure problems left due to the wrong max width from the hook. I am looking into a more complete fix. I happened across another way to reproduce this that doesn’t depend on the Image block being wrapped. It is theme and block alignment dependent. Some themes don’t specify a
|
I changed the title to be more generic since this can be reproduced outside of row/stack blocks. Also linked a sub-issue that details another way to reproduce this. |
Description
When an image is selected within row or stack blocks, its size occasionally changes unpredictably. This issue disrupts the editing experience and makes alignment or sizing adjustments more challenging.
Steps to reproduce
I also included the pattern below for testing.
Here's the pattern (just add your own image to it)
Expected
The image should maintain its size and proportions upon selection, ensuring a stable editing experience.
Visual
CleanShot.2024-12-02.at.16.58.56.mp4
The text was updated successfully, but these errors were encountered: