motiondivision / motiondivision/motion

[BUG] motion.svg style prop changes don't get applied

Open
#2,365 0 comments 1 reaction 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

1. Read the FAQs 👇

2. Describe the bug

motion.svg motion.svg style prop changes don't get applied.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/s/quirky-bhabha-qh8hrn?file=/src/App.tsx

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/quirky-bhabha-qh8hrn?file=/src/App.tsx
  2. Click on the red rectangle next to "motion.svg"
  3. Expected result: the rectangle turns from red to blue
  4. Actual result: the rectangle stays red

5. Expected behavior

Style prop changes on motion.svg should be reflected on the SVG element similar to using a regular svg element. Using a MotionValue works but I'd prefer not to have to create a MotionValue for each style properties. This works as expected on motion.div.

6. Video or screenshots

If applicable, add a video or screenshots to help explain the bug.

7. Environment details

MacOS, issue is on chrome, safari

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 CodeSandbox reproduction and its src/App.tsx entry point; reproduce the click and inspect the motion.svg style-prop change against the stated regular svg expectation. Done means the rectangle changes from red to blue through a style prop without creating a MotionValue, while preserving the reported motion.div behavior.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.