Browse Source

Merge pull request #1979 from isaac-mercieca/4.x

Element keeps the focus to itself in ie11
Robin Herbots 7 years ago
parent
commit
ec41c96c55
1 changed files with 5 additions and 3 deletions
  1. 5 3
      js/inputmask.js

+ 5 - 3
js/inputmask.js

@@ -2541,8 +2541,10 @@
 
                         input.inputmask.caretPos = {begin: begin, end: end}; //track caret internally
                         if ("selectionStart" in input) {
-                            input.selectionStart = begin;
-                            input.selectionEnd = end;
+                            if (input === document.activeElement) {
+                              input.selectionStart = begin;
+                              input.selectionEnd = end;
+                            }
                         } else if (window.getSelection) {
                             range = document.createRange();
                             if (input.firstChild === undefined || input.firstChild === null) {
@@ -3203,4 +3205,4 @@
         return Inputmask;
     }
 ))
-;
+;