-
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
Drop zone: avoid media query on mount #60546
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. |
c5e375b
to
c8f7e30
Compare
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.
Refactor looks good and still works as expected 👍
A month ago we discussed The point is that each instance of Opposed to that, |
Yes, I think this is a good idea for a follow-up. I know @DaniGuardiola mentioned he was looking at |
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.
Works well in my testing and code looks good 👍
As @jsnajdr suggested, it could be a good follow-up opportunity to refactor our media query hooks to run fewer times.
@@ -25,6 +25,71 @@ import { | |||
import type { DropType, DropZoneProps } from './types'; | |||
import type { WordPressComponentProps } from '../context'; | |||
|
|||
function DropIndicator( { label }: { label?: string } ) { | |||
const disableMotion = useReducedMotion(); | |||
const backdrop = { |
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.
Nit: Given we continue to work with framer motion for this animation (which @DaniGuardiola is looking at changing in #60975), those animation variants could be declared outside of the component, there's no need to redefine them on every DropIndicator
render.
cd1c578
to
c147d76
Compare
What?
useReducedMotion
triggers a media query, and it's not needed until blocks are dragging over this component.Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast