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

[BUG] - Chrome autofill changes background color for Input component #1346

Closed
twirlse opened this issue Aug 10, 2023 · 8 comments · Fixed by #3430
Closed

[BUG] - Chrome autofill changes background color for Input component #1346

twirlse opened this issue Aug 10, 2023 · 8 comments · Fixed by #3430
Labels
🐛 Type: Bug Something isn't working

Comments

@twirlse
Copy link

twirlse commented Aug 10, 2023

Describe the bug

When selecting a value from chrome autocomplete its background changes to lightblue.

Your Example Website or App

Please see sample at https://github.com/twirlse/nextui-autocomplete-bug

Steps to Reproduce the Bug or Issue

Create an input that Chrome has autocomplete values for (i.e. email).
See attached animation.

Expected behavior

Background color for input should not change.

Screenshots or Videos

Animation

Operating System Version

Windows

Browser

Chrome

@twirlse twirlse added the 🐛 Type: Bug Something isn't working label Aug 10, 2023
@twirlse twirlse changed the title [BUG] - Chrome autofill changes background color for input [BUG] - Chrome autofill changes background color for Input component Aug 10, 2023
@jguddas
Copy link
Contributor

jguddas commented Aug 10, 2023

Background color for input should not change.

Strongly disagree, we should definitely reflect user action.

Maybe do it in a prettier way tho :)

@twirlse
Copy link
Author

twirlse commented Aug 10, 2023

Well at least it should look nice.
I haven't seen (or probably haven't noticed) this behavior on other sites.

@jrgarciadev
Copy link
Member

@jguddas Maybe we could take leverage of TailwindCSS autofill pseudo class https://tailwindcss.com/docs/hover-focus-and-other-states#autofill

@jguddas
Copy link
Contributor

jguddas commented Aug 10, 2023

Sure, do you have a certain background color that we should go for, and should it be applied to the whole Input or just the input html element?

@SohamSen15
Copy link

Try to style the input component using the following style:

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active  {
    -webkit-box-shadow: 0 0 0 40px white inset !important;
}

This usually removes the autofill colour changes made by the browsers.

@twirlse
Copy link
Author

twirlse commented Aug 18, 2023

Yeah, absolutely, except, maybe, use a variable for the background color

@bfourgeaud
Copy link

bfourgeaud commented Dec 14, 2023

Even adding a color doesn't work with error states for example ...

Solution would be :

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

@getellez
Copy link

Why the inputs in the documentation doesn't have this behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants