13

It appears when dropdown with suggestion texts opens the input is hovered.
Setting focus, active, hover styles doesn't help. It looks like it's out of DOM. enter image description here
How can I remove the border and the background of an input text in Edge?

UPDATE

If there is no css solution, can anybody answer me with a link to how-it-works-article and/or provide me a javascript workaround (I want it to be like in google.com search input).

TylerH
  • 20,799
  • 66
  • 75
  • 101
g1un
  • 374
  • 5
  • 20

5 Answers5

8

You have to add autocomplete="off" in your input field

<input type="text" placeholder="Type here" autocomplete="off">

And

If it is a dynamic element or you can't add this in your input then you can do this with a simple script

$('input').attr('autocomplete','off');

This can be useful for you

Mukul Kant
  • 7,074
  • 5
  • 38
  • 53
6

From the answers given to this similar question on SO, and as you suspected yourself, the autocomplete list that appears beneath the textbox is out of the DOM and so cannot be targeted by CSS.

From my experimenting on codepen it appears that Edge is overlaying a semi-transparent element over the textbox (matched in both height and width), rather than the styling being applied to the textbox itself.

My first demo on codepen shows what happens with the styling when autocomplete is turned off. You will see that by chaining the :hover and :focus pseudo-classes I can create a different style when hovering over a textbox that is already in focus (blue when in focus, red when hovering over the same textbox when it is in focus).

This is worth noting when looking at my second demo on codepen (in Edge, obviously) which has autocomplete turned on. When you click into the textbox the background colour is red (as is expected - I am hovering over a textbox that is in focus). However, move your mouse slightly and the background changes to blue, indicating that the textbox is active but is no longer being hovered over. This isn't correct - we're still hovering over it.

This could be a quirk with Edge, or a bug with how the browser handles autocomplete. It could be worth raising with Microsoft - there doesn't appear to be anything listed regarding this on their issue tracker.

One of the answers given in the first link I provided suggests using jQueryUI's implementation of autocomplete. It's a bit of a faff when the browser should do it by default, but you will be able to target the styling of the autocomplete list and, in theory, avoid the issue you are having.

PTD
  • 1,028
  • 1
  • 16
  • 23
  • There were no answers that fully satisfy me. But I want to reward this one, because it tries to understand the problem and suggests variant of solving my problem without giving up dropdown. – g1un Jul 26 '17 at 10:17
  • @g1un - I appreciate it, though it's a shame we couldn't find a better solution. I think I will log the issue with Microsoft anyway, just to get their take on it. If they do fix it it will be one less browser quirk to worry about – PTD Jul 26 '17 at 10:26
  • 1
    Is there some link to the issue? –  Jan 03 '18 at 11:17
  • @DanielRuf - I never got round to logging it, but the issue I demonstrated in my codepen seems to be working as expected in Edge now. – PTD Jan 10 '18 at 14:52
  • Well so far we could not solve it with CSS and there seems to be no solution so far. –  Jan 13 '18 at 18:32
  • Interestingly, while it was working on my work laptop it doesn't appear to be behaving on my desktop at home... – PTD Jan 14 '18 at 17:02
  • Apparently once I save login in Google Chrome and it starts using autofill - the behaviour is exactly the same as in Edge – Boppity Bop Jan 05 '21 at 18:07
5

Better turn off the autocomplete

<input type="text" placeholder="Type here" autocomplete="off">
Shaheed Mon
  • 471
  • 4
  • 8
0

I haven't tested it, I have no access to IE right now, but in other browsers some default behaviours can be updated using some CSS. Hope it can help you:

appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
Diego N.
  • 562
  • 3
  • 10
0

Just add outline: none; in ur css and it should do the trick!

CSS:

input { 
   outline: none;
}

HTML:

<input style="outline: none;" type="text" id="lname" name="lname">
Dreamer64
  • 923
  • 2
  • 13
  • 30