-
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
Focal Point Picker: Set grid overlay state when dragging #63088
Conversation
const timeout = window.setTimeout( () => { | ||
setShowGridOverlay( false ); | ||
}, GRID_OVERLAY_TIMEOUT ); |
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've omitted this logic from the update. I'm happy to restore it, but I've not noticed a big difference.
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.
In general I'm a fan of avoiding effects. The difference this makes is that the grid overlay is not shown when using the inputs to change the focal point.
Possibly there’s a way to rework how the Grid
visibility changes so that it show/hides without using state and avoid the effect but I'm not sure.
I don’t have much of an opinion on whether it’s okay to omit showing the grid for changes from the inputs.
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. |
As @stokesman also mentioned, the grid overlay currently shows any time the value of the focal point changes — that can happen in a few ways:
Currently, in this PR the grid shows only when dragging the dot. Personally, I feel like we should continue to show the grid overlay on all user interactions (including clicks and number input interactions). Also, out of curiosity — is there a particular reason why we need to rework this logic? As much as I don't like even synchronisation, the current implementation seemed to work well. |
I totally missed that grid was showing on any other interaction 😅 Got idea of the idea of this refactoring after I fixed a bug in this area. I agree that with described terms effect sync makes sense. Thanks for the feedback 🙇 |
What?
PR updates the
FocalPointPicker
to set theshowGridOverlay
state viaonDragStart
andonDragEnd
callbacks.Why?
The component has clear events that trigger point updates; we can set related states during these events and avoid effect synchronization.
Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2024-07-03.at.15.54.40.mp4