-
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
Refactor useShowMoversGestures
hook
#52792
Conversation
Size Change: -164 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6cf2003. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5610610622
|
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.
Good job untangling stuff. It's already helping me understand the pieces better.
4fb0ea8
to
a944784
Compare
Sorry for the late reply; the refactoring and the fix look good to me. Maybe a different name would be more appropriate for this hook. Unless I misunderstand the meaning of "gestures" this hook has nothing to do with them. I usually associate them with special handlers for touch devices. I can only think of the |
Yeah, I had some trouble choosing a name.. I get your point but still the hook is more about hovering/focus, despite of the fact that now it highlights a block. With something like |
Sounds good to me 👍 |
What?
This PR fixed a stale clientId issue in
useShowMoversGestures
callback. After that, @Mamaduka spotted a similar issue for a follow up. I had trouble understanding whatuseShowMoversGestures
is and after investigating I think the name should be about handling when a node is focused or hovered - thus I renamed the hook touseShowHoveredOrFocusedGestures
.The original hook's name would have to do with the fact that
movers
weren't in the toolbar(as are for a while now) and we were showing when the blocktype and parent blocktype icons were focused or hovered. Since the only thing we do for them is highlight a block, I removed the callback and baked thetoggleBlockHighlight
action inside the internal hook, which is not publicly exported.Testing Instructions
select parent
in block settings dropdownCleanShot.2023-07-19.at.14.22.13.mp4