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

[TextField] Autofill detection not working in production #26449

Closed
2 tasks done
michal-perlakowski opened this issue May 25, 2021 · 8 comments · Fixed by #28070
Closed
2 tasks done

[TextField] Autofill detection not working in production #26449

michal-perlakowski opened this issue May 25, 2021 · 8 comments · Fixed by #28070
Labels
bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! regression A bug, but worse v5.x
Milestone

Comments

@michal-perlakowski
Copy link
Contributor

In production, the TextField label is not shrunk when using autofill:
image

Demo: https://jsfiddle.net/284y3evu/
Steps to reproduce:

  1. Fill in the form and click submit.
  2. Choose to save the password in browser.
  3. Go back in the iframe, or refresh the page.
  4. Use the autofill.

It works fine with development bundles. Same demo, with only Emotion and Material-UI changed to development versions: https://jsfiddle.net/284y3evu/1/

The cause of this issue seems to be that in production the @keyframes mui-auto-fill declaration is removed from the styles. Adding some styles to the keyframes (InputBase.js:488) fixes the issue, for example:

<GlobalStyles
    styles={{
        '@keyframes mui-auto-fill': { '100%': { display: 'block' } },
        '@keyframes mui-auto-fill-cancel': { '100%': { display: 'block' } },
    }}
/>

But perhaps there's a better solution. Maybe somthing can be changed in Emotion configuration.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.
@michal-perlakowski michal-perlakowski added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 25, 2021
@oliviertassinari oliviertassinari added the component: text field This is the name of the generic UI component, not the React module! label May 31, 2021
@eps1lon

This comment has been minimized.

@eps1lon eps1lon marked this as a duplicate of #22488 Jun 11, 2021
@eps1lon eps1lon closed this as completed Jun 11, 2021
@eps1lon eps1lon added the duplicate This issue or pull request already exists label Jun 11, 2021
@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 11, 2021
@michal-perlakowski

This comment has been minimized.

@stass-1
Copy link

stass-1 commented Jul 13, 2021

This issue still reproducing
"@material-ui/core": "5.0.0-alpha.38", "@material-ui/styles": "5.0.0-alpha.36", "@emotion/react": "^11.0.0", "@emotion/styled": "^11.0.0",

@liho98
Copy link

liho98 commented Aug 14, 2021

why are you closing this issue, that #22488 issue has been closed, its not duplicate, dont you even try the author's code? before closing this issue, OMG.... Please reopen it. Its critical bug on production, my version is @material-ui/core": "5.0.0-alpha.31, I did try update to latest version, same result.

Duplicate of #22488

local development
image
image

production build
image
image

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work regression A bug, but worse v5.x and removed duplicate This issue or pull request already exists labels Aug 19, 2021
@oliviertassinari oliviertassinari added this to the v5-candidate milestone Aug 19, 2021
@Asdf0717

This comment has been minimized.

@mnajdova
Copy link
Member

mnajdova commented Aug 31, 2021

Thanks for the report. Initially, the keyframes had the from: {} in them, I propose we add the same. This diff is fixing the issue:

index 1dcc7687c3..ceff2a66a0 100644
--- a/packages/material-ui/src/InputBase/InputBase.js
+++ b/packages/material-ui/src/InputBase/InputBase.js
@@ -485,8 +485,8 @@ const InputBase = React.forwardRef(function InputBase(inProps, ref) {
     <React.Fragment>
       <GlobalStyles
         styles={{
-          '@keyframes mui-auto-fill': {},
-          '@keyframes mui-auto-fill-cancel': {},
+          '@keyframes mui-auto-fill': { from: {} },
+          '@keyframes mui-auto-fill-cancel': { from : {} },
         }}
       />
       <Root

My bad, was testing in dev mode 🤦 This didn't help as well, so I propose we go with:

index 1dcc7687c3..ceff2a66a0 100644
--- a/packages/material-ui/src/InputBase/InputBase.js
+++ b/packages/material-ui/src/InputBase/InputBase.js
@@ -485,8 +485,8 @@ const InputBase = React.forwardRef(function InputBase(inProps, ref) {
     <React.Fragment>
       <GlobalStyles
         styles={{
-          '@keyframes mui-auto-fill': {},
-          '@keyframes mui-auto-fill-cancel': {},
+          '@keyframes mui-auto-fill': { from: { display: 'block' } },
+          '@keyframes mui-auto-fill-cancel': { from: { display: 'block' } },
         }}
       />
       <Root

We already have that as a style on the InputBaseComponent, so it should be safe.

@mnajdova mnajdova modified the milestones: v5-candidate, v5 Aug 31, 2021
@josepharhar
Copy link

I recently made the display property animatable in chrome, so the fix is now starting unwanted animations in stable chrome

I filed an issue here: #39539

I think that switching from display to a different non-animatable property like animation-name would fix it.

@tripolskypetr

This comment was marked as off-topic.

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! regression A bug, but worse v5.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants