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] Default Webkit autofill color does not use variables or palette #44665

Open
JeffBaumgardt opened this issue Dec 5, 2024 · 6 comments
Assignees
Labels
component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted waiting for 👍 Waiting for upvotes

Comments

@JeffBaumgardt
Copy link

JeffBaumgardt commented Dec 5, 2024

WebkitBoxShadow: theme.palette.mode === 'light' ? null : '0 0 0 100px #266798 inset',

Looking at this I was having issue with the color of the TextField when autofill was put in (Chrome). The color is hardcoded in and not referenced to any css var or theme.palette. I can of course override this with sx props on the slotProps.htmlInput or globally override in the theme.

It seems like a very odd choice to do a very solid dark blue when someone could have a completely different color theme than the default blue.

Search keywords:

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 5, 2024
@mj12albert mj12albert added component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Dec 6, 2024
@mj12albert
Copy link
Member

Do you think this could be part of the theme too @zanivan ?

@JeffBaumgardt
Copy link
Author

Poking around too. It's only the OutlinedInput that has any kind of autofill behaviour. I'm wondering if/why it can be removed entirely? Not sure if there was something in the material spec that called out for this.

The user agent also does apply styles in Chrome at least and they are marked as !important which is not ideal so even the CSSBaseline can't do much to reset that.

@zanivan zanivan removed their assignment Dec 9, 2024
@zanivan
Copy link
Contributor

zanivan commented Dec 9, 2024

Hey @mj12albert, in my opinion, I think this should be part of the theme. I had a hard time to customize this while working on the new templates—specially for the OutlinedInput—so, if we could make it easier for users, it'd be a great improvement. Marking @siriwatknp and @DiegoAndai so they can triage this issue.

@JeffBaumgardt
Copy link
Author

Honestly unless there is a spec requirement on Material I don't think there should be a webkit autofill style on the OutlinedInput. For UX consistency the other input variants do not have this behaviour and it's a weird edge case that designers don't normally account for. We found this in a customer demo where they have autofill enabled.

@mj12albert
Copy link
Member

Some more context, the color choice intends to be a dark mode alternative for Chrome's built-in autofill color: #14427 (comment)

They're present on both the Filled and Outlined inputs: https://github.com/search?q=repo%3Amui%2Fmaterial-ui%20path%3A%2F%5Epackages%5C%2Fmui-material%5C%2Fsrc%5C%2F%2F%20WebkitBoxShadow&type=code

@mj12albert mj12albert added waiting for 👍 Waiting for upvotes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 10, 2024
@mj12albert mj12albert changed the title Default Webkit autofill color not using variables or palette [TextField] Default Webkit autofill color does not use variables or palette Dec 10, 2024
@DiegoAndai
Copy link
Member

@zanivan we could add a variable for it. It could work like palette.FilledInput.bg: https://github.com/mui/material-ui/blob/master/packages/mui-material/src/styles/createThemeWithVars.js#L271.

Would you be willing to work on this? I'll also add the ready to take label in case someone else wants to pick it up.

@DiegoAndai DiegoAndai added the ready to take Help wanted. Guidance available. There is a high chance the change will be accepted label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material ready to take Help wanted. Guidance available. There is a high chance the change will be accepted waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

4 participants