-
Notifications
You must be signed in to change notification settings - Fork 46
fix(web): honor reduced-motion preferences across product UI #4855
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,9 +9,9 @@ export function TypingIndicator() { | |
| <Bot className="h-4 w-4" /> | ||
| </div> | ||
| <div className="mt-2 flex gap-1"> | ||
| <div className="h-2 w-2 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.3s]" /> | ||
| <div className="h-2 w-2 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.15s]" /> | ||
| <div className="h-2 w-2 animate-bounce rounded-full bg-gray-400" /> | ||
| <div className="motion-reduce:bg-gray-400 motion-reduce:opacity-40 h-2 w-2 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.3s]" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Two issues with the added utility classes on these three dots:
Reply with |
||
| <div className="motion-reduce:bg-gray-400 motion-reduce:opacity-40 h-2 w-2 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.15s]" /> | ||
| <div className="motion-reduce:bg-gray-400 motion-reduce:opacity-40 h-2 w-2 animate-bounce rounded-full bg-gray-400" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import type { StoryObj } from '@storybook/react'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: New story file is in the wrong directory and missing the required default export - it will not be picked up by Storybook Two problems:
Move this file to Reply with |
||
| import { TypingIndicator } from '@/components/cloud-agent-next/TypingIndicator'; | ||
| import HeaderLogo from '@/components/HeaderLogo'; | ||
|
|
||
| type Story = StoryObj; | ||
|
|
||
| export const Normal: Story = { | ||
| render: () => ( | ||
| <div className="flex flex-col gap-4"> | ||
| <TypingIndicator /> | ||
| <HeaderLogo /> | ||
| </div> | ||
| ), | ||
| }; | ||
|
|
||
| export const ReducedMotion: Story = { | ||
| render: Normal.render, | ||
| }; | ||
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.
Would it be better to use the automatic method for respecting user motion preferences?
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 think a hybrid approach works best here.
We can use
<MotionConfig reducedMotion="user">at the root level to reduce boilerplate and automatically respect the user preference for motion across standard Motion components. Motion will disable transform and layout animations for reduced motion users while other supported animations can still run.However useReducedMotion is still useful for components where we explicitly want to change the rendering logic. For example in FrontierGlow (OnboardingStepModel.tsx) the drifting blobs are purely decorative so using !shouldReduce lets us avoid rendering them entirely instead of leaving them as static background elements.
Proposed solution:
Add
<MotionConfig reducedMotion="user">around the root providers so standard Motion components respect reduced motion automaticallyKeep useReducedMotion only in components where reduced motion requires conditional rendering or other custom logic such as FrontierGlow