Material-ui: [TextField] Change -webkit-autofill style

Created on 28 Jan 2015  路  14Comments  路  Source: mui-org/material-ui

should we disable -webkit-autofill style

ugly when i use the autofilll value
image
image

TextField question

Most helpful comment

I found this bit of a hack, using css transition to delay -webkit-autofill. Only tested in Chrome v56.0.2924.87

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
    transition-delay: background-color 5000s, color 5000s;
}

image

All 14 comments

I've had some people complain about this on the site I work on. Maybe there's a workaround, like making the element smaller so it looks more normal? Thoughts?

I think removing it actually reduces user friendliness.

@zhiqingchen @danmartinez101 @akinnee this issue has been sitting for quite a while. If this functionality is still desired, would one of you like to submit a quick PR?

I am not sure why this is closed as this issue is still not resolved. Removing the style entirely is a workaround but not a solution. Could the TextField still have the same style if we shrunk the <input /> and add more styling to container elements?

Would also love to see a fix for this -- seems like anyone using the input fields for passwords is going to be affected right out of the gate (like I was)

+1 looking for alternatives... anybody have one besides removing all styling?

image

I found this bit of a hack, using css transition to delay -webkit-autofill. Only tested in Chrome v56.0.2924.87

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
    transition-delay: background-color 5000s, color 5000s;
}

image

This issue is still happening. Why did it got closed? @zhiqingchen

you can add this code to your index.css:

input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px #FFFFFF inset;
}

you can add this code to your index.css:

input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 30px #FFFFFF inset;
}

if i want to write css file , why using material-ui? the problem is about that how can we solve it in material-ui , not in css

@nimahkh Ive just come across the same issue, I wanted to be able to handle this within my Material-ui theme provider (although ideally it would be good for M-UI to maybe have a more elegant way of dealing with this), but the work-around I came to was adding the following to my MUI theme overrides:

overrides: {
  MuiOutlinedInput: {
    input: {
      '&:-webkit-autofill': {
        WebkitBoxShadow: '0 0 0 100px #266798 inset',
        WebkitTextFillColor: '#fff',
      },
    },
  },
}

using this pattern you should be able to apply the style rulings described in this CSS-tricks article.

Hope that helps!

Here what I did and it works specifically for Mui 馃槃
````

myMuiClass: {
'& input:-webkit-autofill': {
'-webkit-box-shadow': '0 0 0 30px red inset !important'
},
'& input:-webkit-autofill:hover': {
'-webkit-box-shadow': '0 0 0 30px red inset !important'
},
'& input:-webkit-autofill:focus': {
'-webkit-box-shadow': '0 0 0 30px red inset !important'
},
'& input:-webkit-autofill:active': {
'-webkit-box-shadow': '0 0 0 30px red inset !important'
}
}
````
Enjoy 馃殌

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reflog picture reflog  路  3Comments

zabojad picture zabojad  路  3Comments

mb-copart picture mb-copart  路  3Comments

newoga picture newoga  路  3Comments

FranBran picture FranBran  路  3Comments