DEV Community

Sherotree
Sherotree

Posted on

Ask the agent for a reduced-motion path when it adds an animation

The agent adds a delightful entrance: a 400ms slide plus a fade, triggered whenever the drawer opens. It looks polished in the default OS setting. On a machine with “reduce motion” enabled, the drawer still slides, because nobody asked the model to read prefers-reduced-motion.

I’ve started requiring a reduced-motion note in any agent PR that adds an animation, transition, or view transition. The note can be “wrapped in the existing motion-safe utility” or “this one is a 150ms opacity fade, which we allow.” Silence is not a plan.

Why this gets dropped

The happy path is what the prompt described: “animate the panel in.” Tutorials still lead with @keyframes and transition: all. prefers-reduced-motion is a second paragraph the model will skip unless you make it a gate.

The cost is not theoretical. Vestibular-sensitive users, people who enabled the OS setting, and anyone in a reduced-motion CI story will all see the same motion you thought was optional decoration.

You do not have to delete every animation. You do have to define the reduced path: usually cut transform/layout motion, keep a short opacity fade if the team allows it, or jump to the end state.

A simple motion policy

  • Any new animation ships a reduced-motion path in the same PR
  • Prefer the existing helper — motion-safe:, @media (prefers-reduced-motion: reduce), or the design-system motion mixin
  • No transition: all
  • State, not only CSS — if you use a JS animation library, it must honor the same media query or the platform matchMedia

If the team already wrote a reduced-motion article or a token scale, point the agent at that file instead of restating the CSS.

What to put in the prompt

If you add a transition, animation, or view transition, include a prefers-reduced-motion path in the same PR.
Use the existing motion helper in src/styles/motion.css.
Do not use transition: all.
In the PR body, say what still moves (if anything) when reduced motion is on.
Enter fullscreen mode Exit fullscreen mode

Add a Storybook or Playwright case with prefers-reduced-motion: reduce if you already test other a11y states there. A screenshot of the default theme is not coverage.

View Transitions and shared-element animations are included. If the agent adds document.startViewTransition or a view-transition-name, the reduced-motion path should skip the transition or fall back to a plain swap. The CSS View Transitions API does not make the OS setting optional.

Carousel autoplay, skeleton shimmer, and infinite logo marquees are also motion. If marketing wants them on by default, they still need a stop when the user asked for less movement. “It is decorative” is an argument for honoring the setting, not for ignoring it.

Reject / send back

Reject

  • A new transform animation with no reduced-motion branch
  • transition: all 300ms
  • A JS animate() call that ignores the media query
  • “It’s a short animation, so it’s fine” with no policy citation

Accept

  • An existing motion-safe / motion-reduce utility applied correctly
  • An instant end-state (or a short opacity-only fade, if your scale allows it) under reduced motion
  • A PR note that names the helper and the reduced behavior

Top comments (0)