I\'m unable to get IE11 to focus an input element after it is inserted into the DOM. The element won\'t receive text input after being focused, but its placeholder text is n
As stated in https://stackoverflow.com/a/31971940, running element.focus() has no effect in IE11 when the css property -ms-user-select: none is set.
A workaround can be
element.style['-ms-user-select'] = 'text';
element.focus()
element.style['-ms-user-select'] = '';
Does not work in IE: https://codepen.io/macjohnny-zh/details/WPXWvy
(Code: https://codepen.io/macjohnny-zh/pen/WPXWvy)
Works in IE, too: https://codepen.io/macjohnny-zh/details/LqOvbZ
(Code: https://codepen.io/macjohnny-zh/pen/LqOvbZ)
Note: this also happens e.g. for
:-ms-input-placeholder {
-ms-user-select: none;
}
See https://github.com/angular/material2/issues/15093