-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
GridItemResizer: Fix resizing when List View is open #61643
GridItemResizer: Fix resizing when List View is open #61643
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.
Nice one, that appears to have done the trick! I just gave it a very quick test and it's testing nicely for me in the post and site editors. I've run out of time to give this a proper code review today, but just wanted to confirm that it looks like it's resolved the bug 👍
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! This fixes the issue for me and cleans up the code a bit 🎉
Size Change: -122 B (-0.01%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
What?
Fixes a bug noticed in #61641 (which is in turn part of #61633) where the grid item resizes behaves funnily when the List View is opened.
How?
Opening the List View changes the origin that
getBoundingClientRect()
uses which means that the bounds rectangle we pass toResizableBox
is no longer correct.We could update our logic that calculate
bounds
to accomodate the List View, but I think this is too complicated.So instead I replaced the logic we use for calculating bounds with something that I think is simpler which is setting
ResizableBox
'sbounds
prop to be.block-editor-grid-visualizer__grid
which we know will be on screen, not in the iframe, and the correct size and position to act as bounds.I'm doing some ref passing instead of
querySelector
because I think it makes the relationship more explicit.Testing Instructions