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

Only add "transform" to will-change #2818

Merged
merged 5 commits into from
Oct 3, 2024
Merged

Only add "transform" to will-change #2818

merged 5 commits into from
Oct 3, 2024

Conversation

mattgperry
Copy link
Collaborator

This PR changes the behaviour of auto will-change. Rather than add every animating value to will-change (as preferred) it only enables layerisation by adding "transform".

This prevents a bug in Chrome that flattens the 3D perspective of an element when will-change: opacity/filter/clip-path is added, rather than when one of those values is non-default.

@mattgperry mattgperry requested a review from adamseckel October 2, 2024 14:12
@mattgperry mattgperry merged commit dc9d6b3 into main Oct 3, 2024
1 check passed
@mattgperry mattgperry deleted the fix/will-change branch October 3, 2024 07:32
@lochie
Copy link
Contributor

lochie commented Oct 4, 2024

@mattgperry just a heads up that this update caused some unexpected breaking changes.

The change of the automated will-change property from opacity to transform breaks z-index and height: x% within child elements, and I'm sure there are a few other quirks that could occur as well.

Screen.Recording.2024-10-04.at.12.48.35.PM.mov

I resolved this by overriding with will-change:opacity !important;, but am wondering if there a flag to disable framer-motion's automated will-change property? If not, it might be good to have ☺️

@mattgperry
Copy link
Collaborator Author

mattgperry commented Oct 8, 2024

@lochie Yeah I can see a config option being useful. But also I am inclined to changing it back to how it was and fixing this Chrome behaviour (only really a problem in Framer) another way.

@mattgperry
Copy link
Collaborator Author

@lochie Btw you can also just set style={{ willChange: "opacity" }} on the component to override

@lochie
Copy link
Contributor

lochie commented Oct 8, 2024

@mattgperry would be nice to change it back if possible, but I don't know the full scale of this feature so I don't wish to push this in any particular direction, I just wanted to alert of an issue that appeared for me.

And just tested style={{ willChange: "opacity" }} does fix it. I think I just added !important because I was rushing to fix 😅

Thanks for the response, and as always, love your work 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants