Browse Source

Phone Mask Cursor Issue on Chrome on some Androids.. #1490

Robin Herbots 8 years ago
parent
commit
cf4695b79d
2 changed files with 10 additions and 4 deletions
  1. 1 0
      CHANGELOG.md
  2. 9 4
      js/inputmask.js

+ 1 - 0
CHANGELOG.md

@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
 	- initialization
 
 ### Fixed
+- Phone Mask Cursor Issue on Chrome on some Androids.. #1490
 - min value issue fix #1177
 - static is a reserved keyword #1479
 - hasOwnProperty check missing in reverseTokens (numericInput) #1486

+ 9 - 4
js/inputmask.js

@@ -1312,10 +1312,10 @@
 						//return is false or a json object => { pos: ??, c: ??} or true
 						rslt = test.fn != null ?
 							test.fn.test(chrs, getMaskSet(), position, strict, opts, isSelection(pos)) : (c === test.def || c === opts.skipOptionalPartCharacter) && test.def !== "" ? //non mask
-							{
-								c: getPlaceholder(position, test, true) || test.def,
-								pos: position
-							} : false;
+						{
+							c: getPlaceholder(position, test, true) || test.def,
+							pos: position
+						} : false;
 
 						if (rslt !== false) {
 							var elem = rslt.c !== undefined ? rslt.c : c;
@@ -1729,6 +1729,11 @@
 			input.inputmask._valueSet(buffer.join(""));
 			if (caretPos !== undefined && (event === undefined || event.type !== "blur")) {
 				caret(input, caretPos);
+				if (android && event.type === "input") {
+					setTimeout(function () {
+						caret(input, caretPos);
+					}, 0);
+				}
 			} else renderColorMask(input, buffer, caretPos);
 			if (triggerInputEvent === true) {
 				skipInputEvent = true;