-
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 placement of resizable overlay #69381
base: trunk
Are you sure you want to change the base?
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. |
Size Change: +21 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
What?
Follow up to #68666.
Improves positioning of the resizable component in the Image block.
Why?
The resizable component is now overlaying the image instead of wrapping it. This means they could become misaligned. While some logic to maintain their alignment was included, it proves to be insufficient in at least the TT1 theme. Using
Popover
fixes that particular issue and probably other edge cases we’ve yet to encounter.How?
Leverages the
Popover
’s comprehensive anchoring behavior to keep the resizable component overlaid on the image.Additional implementation notes
The Cover block had almost this same thing done a while back. It’s different in that its popover is based on
BlockPopoverCover
instead ofPopover
. That component would seem most suitable to reuse here yet this use case has an important difference that is not supported by it—the anchor of the popover is a child of the root block element.I experimented with extending
BlockPopoverCover
for this use case and it can be done simply enough. However, it won’t much simplify the implementation in the Image block. Further, it would introduce some inefficiency withBlockPopoverCover
redundantly observing resizes of the anchor—something the Image block is already doing and utilizing the result in a least a couple of ways. Overall, this is simpler.Perhaps if more use cases like this crop up it would be worth considering extending
BlockPopoverCover
.Testing Instructions
Screenshots or screencast
Before with TT1
TT1-resizable-fail.mp4
After with TT1
TT1-resizable-success.mp4