-
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
ResizableBox: Make invisible resize handles bigger #14481
Conversation
This definitely seems like a nice change! How does it work for the overlapping corners? (I don't have access to a Gute dev environment at the moment) Is it just based on whichever z-index is higher? One thing to note is that |
Yes, the order of elements in DOM will determine that as I think they don't have distinct z-indexes.
The underlying library does support it I think but the wrapper component that was made for Gutenberg is only limited for top, bottom, left and right in JS code (no corners) and actually the This keeps us with |
We can probably very easily add support to all those possible options so there are no surprises to future users of the component. I think that should be the right way to proceed, considering those options were already advertised in README of that component (despite not working) |
Judging purely by the goal of this PR, and the screenshots/GIFs (thanks for including those), this is a solid enhancement 👍 👍 I would echo Chris that it'd be nice to explore corner resizing at some point in the future, either through an enhancement to ResizableBox or through finding a better library. But as it is, this PR does not seem to regress or change anything from master in that respact, only enhance, so I think it's fine to take this as an iterative improvement and just keep thinking about the more fundamental improvements separately. Nice work, I'd definitely suggest this is ready for a code review as the next step. |
Wow, impressive work! Thanks for making this possible. For now and just to keep this PR smooth sailing, we should probably in the case of the media & text block keep just the one side handle enabled. But good to know we now have additional options! |
Thanks! Just to make it super clear, I used M&T for easy debugging and I don't expect other handles to be added any time soon. |
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.
I can find any issues here. Seems like a nice enhancement.
I also tested with all the drag handles enabled. Just one note (which you've probably seen) that on Media + Text it feels odd to have the corners on the opposite side (ie: the side furthest from the text) enabled.
Great work!
I'd say this is good to go 🚀 |
To clarify my own understanding reflecting on the code: The corner resize exists as a feature of ResizableBox, but it is not as of these changes applied to any block. My YAGNI senses are tingling, but I'd allow it 😄 |
Description
I've suggested several resizing improvements in #14410 and this is one of them. It makes resize handles of
ResizableBox
much bigger - spanning across the whole side they control instead of just the small blue dot in the center.I've built this with Media & Text in mind but it seems it helps other blocks too, especially Spacer where the blue dot collides with "Add Block" button.
Known limitation: This bigger handler is only implemented for Left, Right and Bottom resizers. Those are the only resizers that have been supported and used in our codebase so I've continued with the same limitation.All sides and corners are now supported. Additional testing instructions related to them are in my comments on this PR.
How has this been tested?
Visually, all blocks should look the same and show the blue dot in the center of resizable areas. What should change is the area that you can initiate the resize action from.
ResizableBox
component is used in Media & Text, Spacer and Image blocks. Test all of them and confirm their drag & drop resizing still works in all expected cases. Try resizing by dragging anywhere on a side but outside of the blue dot. Make sure the action is appropriately indicated with a resizing cursor.Screenshots
Green color is for demonstration purposes only to show where the active area is. For users, this should be pretty intuitive as the whole side of media acts as a handler.
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: