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

[material-ui][InputBase] Auto-fill keyframes may cause unwanted animations #39539

Open
josepharhar opened this issue Oct 20, 2023 · 5 comments · May be fixed by #43839
Open

[material-ui][InputBase] Auto-fill keyframes may cause unwanted animations #39539

josepharhar opened this issue Oct 20, 2023 · 5 comments · May be fixed by #43839
Assignees
Labels
bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material regression A bug, but worse

Comments

@josepharhar
Copy link

josepharhar commented Oct 20, 2023

Steps to reproduce 🕹

Link to live example: https://stackblitz.com/edit/react-tsmx9v?file=src%2Fstyle.css

Screen.Recording.2024-09-21.at.19.02.56.mov

Steps:

  1. Load the page in Chrome 117 or newer

Current behavior 😯

The very first frame has the text input box rendered extra tall. The next frame has it at the normal size.
This is happening because the mui-auto-fill-cancel keyframes rule starts an animation.

Expected behavior 🤔

No animation should be started and the first frame should be the same as the final state.

Context 🔦

Hello! I recently implemented a feature in chrome which makes the display property animatable: https://chromestatus.com/feature/5154958272364544

Before I made this change, @keyframes rules with display in them did nothing. The mui-auto-fill keyframes rules in particular would have not started an animation because they didn't contain any animatable properties. Now that display is animatable, it is creating an animation which is only lasting for a single frame.

This was added here: #28070

Based on the issue which that PR fixed, it sounds like there has to be some styles inside the keyframes which don't actually start an animation. I recommend using a property which is pretty much guaranteed to never be upgraded to become animatable, such as the animation-name property. So perhaps replacing display:block with animation-name:hello-world would fix it?

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@josepharhar josepharhar added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 20, 2023
@josepharhar
Copy link
Author

I discovered this from a chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1492888

@josepharhar
Copy link
Author

Here is the keyframes rule:

'@keyframes mui-auto-fill': { from: { display: 'block' } },
'@keyframes mui-auto-fill-cancel': { from: { display: 'block' } },

@josepharhar
Copy link
Author

And here is a list of non-animatable properties in chrome (except display and content-visibility): https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/animation/css/css_animations.cc;l=3111-3160;drc=977dc02c431b4979e34c7792bc3d646f649dacb4

The ones starting with animation are probably the safest to rely on in the future, since we can't let an animation fundamentally change itself in the middle of an animation.

@danilo-leal danilo-leal changed the title mui-auto-fill and mui-auto-fill-cancel keyframes may cause unwanted animations [material-ui][InputBase] Auto-fill keyframes may cause unwanted animations Oct 23, 2023
@mj12albert mj12albert self-assigned this Oct 24, 2023
@mj12albert
Copy link
Member

@josepharhar Thanks for the detailed report ✨

The very first frame has the text input box rendered extra tall. The next frame has it at the normal size.

BTW this was quite hard to see 😅

@ZeeshanTamboli ZeeshanTamboli removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 3, 2023
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work regression A bug, but worse labels Dec 30, 2023
@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 21, 2024

It's a lot more visible on https://mui.com/material-ui/getting-started/templates/dashboard/, really annoying actually

Screen.Recording.2024-09-21.at.19.06.00.mov

Related to #41469. The initial work #14427. A recent follow-up: #28070.

@oliviertassinari oliviertassinari added component: text field This is the name of the generic UI component, not the React module! and removed component: input labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material regression A bug, but worse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants