38

In Google Chrome on MacOS (Version 75.0.3770.142) when I hover over an autofill suggestion the font size in the input becomes very small (also the font family changes) but after choosing the suggestion it goes back to the normal size.

What might be causing this behaviour?

autofill suggestion hover small font size

Kuba Szymanowski
  • 1,307
  • 11
  • 25
  • *What might be causing this behaviour?* Probably the plugin you're using for the autofill – Rainbow Jul 28 '19 at 16:37
  • 3
    related: https://stackoverflow.com/a/56837713/8620333 .. there is some *new* default styles added by chrome for specific states (not easy to override) – Temani Afif Jul 28 '19 at 19:38
  • @ZohirSalak, not a plugin, just the default Google Chrome behaviour. – Kuba Szymanowski Jul 28 '19 at 21:33
  • Oh it's the auto fill for saved passwords and such, funnily enough i can't reproduce on `Windows Chrome 75.0.3770.142 (64-bit)` – Rainbow Jul 29 '19 at 00:16
  • @ZohirSalak Yeah, I tested that on Chrome on Windows and it looks fine. It only breaks on a mac. I suppose it is a bug in Chrome and I just have to wait for a fix. I tried applying some styles from the other question Temani Afif mentioned but it doesn't seem to affect the font size (border color works for example). – Kuba Szymanowski Jul 29 '19 at 07:02
  • This bug has been annoying me for a few weeks now. My Chrome has updated twice since it started happening and it hasn't been fixed yet. Fingers crossed this is a bug and not a feature! – rorymorris89 Jul 31 '19 at 00:23
  • 9
    Possible duplicate of [How to prevent Chrome from changing font when autofilling username/password?](https://stackoverflow.com/questions/56026043/how-to-prevent-chrome-from-changing-font-when-autofilling-username-password) – Thibaud Colas Aug 06 '19 at 15:35
  • @ThibaudColas It is not a duplicate because this issue happens only on a Mac and the linked issue happens only on Windows. – Kuba Szymanowski Aug 06 '19 at 19:24
  • 2
    @KubaSzymanowski as far as I’ve been able to test myself the issue happens identically regardless of operating system, overriding both font-family and font-size. – Thibaud Colas Aug 10 '19 at 11:42
  • I must've been mistaken then. In my tests it only happened on a Mac. This actually may very well be a duplicate. – Kuba Szymanowski Aug 10 '19 at 13:05
  • Does anybody know if there is already an issue filed on Chrome/Chromium? This annoys me as well since a while now. – Dennis Zoma Aug 10 '19 at 19:12
  • 1
    the possible duplicate above's top answer points to a chromium CVE that likely caused this intentional change: https://bugs.chromium.org/p/chromium/issues/detail?id=916838 – manroe Aug 16 '19 at 17:05
  • Possible duplicate of [CSS AutoComplete font size](https://stackoverflow.com/questions/57195620/css-autocomplete-font-size) – ash Sep 30 '19 at 11:09

3 Answers3

18

There is a solution:

input:-webkit-autofill::first-line {font-size: 16px}
fracz
  • 20,536
  • 18
  • 103
  • 149
Ivan
  • 1,487
  • 1
  • 16
  • 27
  • 1
    Thank you. But I notice its not just the font size but font family as well. – Coisox Jun 02 '20 at 02:10
  • 5
    this solution doesnt work anymore in latest versions of Chrome because of a security issue https://bugs.chromium.org/p/chromium/issues/detail?id=1035058 – burakcalik Aug 20 '22 at 01:46
3

Here is working solution that worked for me in 2021 for Chrome not to change font size on autocomplete suggest hover:

input#email {
  font-size: 2rem;
  color: blue;
}

input:-webkit-autofill::first-line {
      color: red;
      font-size: 2rem;
}
<input id="email"></input>

Also I noticed that for some reason display: flex conflicts with that code, take a look:

input#email {
  font-size: 2rem;
  color: blue;
  display: flex;
}

input:-webkit-autofill::first-line {
      color: red;
      font-size: 2rem; 
}
<input id="email"></input>
Dzmitry Dranitski
  • 165
  • 1
  • 4
  • 13
0

input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { // put your old style here }

abdelhedi hlel
  • 2,903
  • 1
  • 16
  • 20