-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[charts] Ensure reduce motion
preference disables animation on page load
#14417
Conversation
Deploy preview: https://deploy-preview-14417--material-ui-x.netlify.app/ |
CodSpeed Performance ReportMerging #14417 will not alter performanceComparing Summary
|
Failing tests are unrelated #14457 |
…mation-on-page-load
export type AnimationProviderProps = { | ||
/** | ||
* If `true`, animations are skipped. | ||
* @default undefined |
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.
Not a big fan of @default undefined
because all props are by default undefined
May be more interesting to describe what happends by default
If unset, charts addapt the user's
prefers-reduced-motion
preferences
By the way since false
does not allow to overrid the user preferences (which I think is expected) why not setting false
as the default value?
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.
Adjusted it to:
If unset or
false
, the animations respects the user'sprefers-reduced-motion
setting.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…mation-on-page-load
Fixes #13477
Could be a starting point for #13964
AnimationProvider
which currently only holds theskipAnimation
valueuseReduceMotion
hook, as it got merged into the provider aboveskipAnimation
, but that felt unnecessary, and the chosen solution could path a way to customising animationsBy moving it to the provider, and passing it as a prop to all animations, we ensure
immediate
is called with the correct prop. I've leftGlobals.assign
in place just in case, but it shouldn't be necessary anymore.Testing
Emulating reduced motion in chrome
https://developer.chrome.com/docs/devtools/rendering/emulate-css#emulate_css_media_feature_prefers-reduced-motion
Running locally
pnpm --filter docs build && pnpm --filter docs serve