-
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
Site Editor: Ensure ResizableFrame does not force Cover blocks within the editor to show drag handles #59262
Site Editor: Ensure ResizableFrame does not force Cover blocks within the editor to show drag handles #59262
Conversation
… the editor to always display drag handle
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: +5 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in ae62676. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7999668258
|
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.
Screen.Capture.on.2024-02-28.at.14-43-17.1.mp4
I tested this and the drag handle is not available once you select an aspect ratio. The only issue is that even if I go back to Original
the drag handle is still not displayed.
The only way to get it back is to set a minimum height.
This might not be an issue because when I reset the aspect ratio control it seems to have a minimum height set by default so perhaps the behaviour of Original
is intentional?
The fix seems good for the original bug though.
Thanks for the review @getdave!
Yes, that's a separate issue in regards to how the aspect ratio controls work, which is that selecting "Original" sets an explicit value rather than clearing out the value. I think we can look at that separately if it winds up being an issue for folks. |
… the editor to always display drag handle (#59262) Co-authored-by: andrewserong <[email protected]> Co-authored-by: getdave <[email protected]>
I just cherry-picked this PR to the update/packages-6.5-rc1 branch to get it included in the next release: 82a4572 |
… the editor to always display drag handle (#59262) Co-authored-by: andrewserong <[email protected]> Co-authored-by: getdave <[email protected]>
What?
In the site editor's
ResizableFrame
component, set theResizableBox
'sshowHandle
prop tofalse
so that CSS rules that show the handles don't flow down to nested resizable boxes that shouldn't display their handles.This resolves an issue in the site editor where the Cover block will show the handles on its resizable box even when it shouldn't be (i.e. when an aspect ratio is set), because the Cover block is rendered further down the tree from this
ResizableFrame
.Why?
By default,
ResizableBox
treatsshowHandle
astrue
and adds a classname that means some CSS rules to reveal the handle will apply to any nested resizable box.To work around this, we can set the
ResizableFrame
to pass infalse
toshowHandle
. Because the site editor'sResizableFrame
uses its own customhandleComponent
with the class name ofedit-site-resizable-frame__handle
, it never received theResizableBox
's CSS rules for showing and hiding the drag handle, so this PR shouldn't affect the resizable frame in any way.While we could potentially resolve this issue over in the resizable box, for 6.5, I think this is likely the safer fix as it's a small change to one component used in one place, where the impact is hopefully fairly well known.
How?
ResizableFrame
component, set theResizableBox
'sshowHandle
prop tofalse
.Testing Instructions
trunk
, note that the drag handle of the Cover block will still be shown, but it'll be in the wrong position, and dragging it will do nothingTesting Instructions for Keyboard
To check for regressions, from the site editor browse mode, make sure that you can still tab all the way over to the drag handle for the resizable frame.
Screenshots or screencast
Before
Note the drag handle that doesn't do anything at the end of this video:
2024-02-22.15.44.05.mp4
After
Drag handle is hidden when aspect ratio is applied (same behaviour as in the post editor):
2024-02-22.15.47.05.mp4
Drag handle that should be unaffected
This is the drag handle for the resizable frame that should be unaffected, and still be able to be tabbed over to by keyboard.