-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Change -webkit-autofill style #283
Comments
This comment has been minimized.
This comment has been minimized.
The information here can be applied to the library: http://stackoverflow.com/questions/2781549/removing-input-background-colour-for-chrome-autocomplete |
I think removing it actually reduces user friendliness. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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;
} |
This comment has been minimized.
This comment has been minimized.
you can add this code to your index.css: input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 30px #FFFFFF inset;
} |
This comment has been minimized.
This comment has been minimized.
@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! |
This comment has been minimized.
This comment has been minimized.
Mi solution was added it on the theme overrides. overrides: {
MuiOutlinedInput: {
input: {
'&:-webkit-autofill': {
'-webkit-box-shadow': '0 0 0 100px #000 inset',
'-webkit-text-fill-color': '#fff'
}
}
}
} |
In MUI v5, it is createTheme({
// your other theme props ...
// one less indent here for readability
components: {
MuiOutlinedInput: {
styleOverrides: {
input: {
"&:-webkit-autofill": {
"-webkit-box-shadow": "0 0 0 100px var(--primary-weak) inset",
"-webkit-text-fill-color": "var(--text-primary)",
},
},
},
},
},
}) Also, I used this to dynamically change the color. (learned this trick here) <GlobalStyles
styles={{
":root": {
"--primary-weak": theme.palette.primary[theme.palette.mode as "dark" | "light"],
"--text-primary": theme.palette.text.primary },
}}
/> |
take a look at this code pen
|
Another alternative to not apply any color to the autofill: components: {
MuiOutlinedInput: {
styleOverrides: {
input: {
"&:-webkit-autofill": {
backgroundClip: "text",
},
},
},
},
} |
should we disable -webkit-autofill style
ugly when i use the autofilll value
The text was updated successfully, but these errors were encountered: