Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove border and background of input in ms edge

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).

like image 579
g1un Avatar asked Jul 14 '17 11:07

g1un


People also ask

How do I disable borders?

On the Page Layout tab, in the Page Background group, select Page Borders. In the Borders and Shading dialog box, on the Page Border tab, under Setting, choose None. Select OK.

How do you remove input from focus?

To remove the focus on an input tag element in HTML, you can use the blur() method on the element using JavaScript. This input tag will be already focussed when a user visits the website and we want to remove the focus when we click the button below it.


1 Answers

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.

like image 58
PTD Avatar answered Oct 14 '22 09:10

PTD