Skip to content
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

Investigate removal of framer-motion #6678

Open
matthewgallo opened this issue Jan 9, 2025 · 3 comments
Open

Investigate removal of framer-motion #6678

matthewgallo opened this issue Jan 9, 2025 · 3 comments
Labels
Debt Experience dropped or altered for implementation release and deferred until later dependencies Pull requests that update a dependency file role: dev
Milestone

Comments

@matthewgallo
Copy link
Member

matthewgallo commented Jan 9, 2025

While framer-motion has been a very convenient tool in orchestrating animations and transitions, we've faced issues in managing it as a dependency given our requirement for continued support of React 16 and up.

After doing a quick review of where and how we're using it, I think we should be able to do everything we're currently doing with framer-motion now with native css. For example, creating an animation on render (which we've commonly relied on AnimatePresence for), can be done all in css now, here is an quick example:

.element {
  transform: translateY(2rem);
  transition-property: opacity, transform;
  transition-duration: 350ms;
  transition-behavior: allow-discrete;
}
.element.hide {
  opacity: 0;
}
.element.show {
  @starting-style {
    opacity: 0;
  }
  opacity: 1;
  transform: translateY(0);
}

See codepen example here.

With the allow-discrete transition-property value, properties like display can also be used in transitions.

@github-project-automation github-project-automation bot moved this to Needs triage 🧐 in Carbon for IBM Products Jan 9, 2025
@matthewgallo matthewgallo added the Debt Experience dropped or altered for implementation release and deferred until later label Jan 9, 2025
@s100
Copy link
Contributor

s100 commented Jan 10, 2025

Removing framer-motion would also resolve the warning we see downstream during Mocha testing of an application which makes use of @carbon/ibm-products:

motion() is deprecated. Use motion.create() instead.

Alternatively, using motion.create() instead could resolve this warning in a slightly lower-effort manner...

@matthewgallo
Copy link
Member Author

Hey @s100! That should no longer be an issue in 2.57.1, we rolled back the framer-motion upgrade to the previous version we had been using.

@elycheea elycheea added dependencies Pull requests that update a dependency file role: dev and removed status: needs triage 🕵️‍♀️ labels Jan 10, 2025
@elycheea elycheea moved this from Needs triage 🧐 to Needs refinement 🤓 in Carbon for IBM Products Jan 10, 2025
@s100
Copy link
Contributor

s100 commented Jan 14, 2025

Hey @s100! That should no longer be an issue in 2.57.1, we rolled back the framer-motion upgrade to the previous version we had been using.

Confirmed, that does actually fix it. Thanks for the tip.

@elycheea elycheea added this to the 2025 Q1 milestone Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debt Experience dropped or altered for implementation release and deferred until later dependencies Pull requests that update a dependency file role: dev
Projects
Status: Needs refinement 🤓
Development

No branches or pull requests

3 participants