IE10 | Adding a Focus Class | Placeholder Padding Issue

Hey all,

I’ve noticed a strange issue on Internet Explorer 10.

It happens when you add/ remove a focus class via JavaScript. The placeholder text is misaligned vertically.

This does not happen if you use a focus selector. Unfortunately I can’t use this approach.

Here is an example:

JavaScript:

var input = document.querySelector('input');

input.addEventListener('click', function () {
    this.classList.add('inputFocus');
});

input.addEventListener('blur', function () {
    this.classList.remove('inputFocus');
});

CSS:

body {
    padding-top: 20px;
}

input {
    padding: 11px 11px 11px 44px;
}

.inputFocus {
    margin-top: -10px;
    padding: 21px 11px 21px 44px;
}

HTML:

 <input type="text" placeholder="Search..." />
```

Cheers!

Your jsfiddle link goes to a blank page rather than a working example. Could you let us know what it should be?

Sorry. I forgot to save it.

There you go!

Cheers.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.