motiondivision / motiondivision/motion

[BUG] CSS variables for bg color + spring for other property causes bg color to misbehave

Open
#2,369 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
33.7k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
14

Description

When I use CSS variables for backgroundColor and a spring animation for an unrelated property - like scale - on the same motion element it causes the backgroundColor to jump back to a previous value near the animation's end.

https://codesandbox.io/s/eloquent-bose-nmqklf?file=/src/App.js

Steps to reproduce

Steps to reproduce the behavior:

  1. Use CSS variables for the backgroundColor property
  2. Use a spring type animation on any other property

Expected behavior
The button animates the same way with CSS variables and a spring animation as it would without them.

Video

video.webm

Environment details

Tested on Chromium (114.0.5735.198) and Firefox (118.0.1)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox and its src/App.js reproduction. Verify the backgroundColor CSS variable together with a spring animation on another property, then compare the result with the non-variable case; done means the background color no longer jumps back near the animation’s end.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.