We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f48907e + 13590da commit 688f804Copy full SHA for 688f804
lib/web/mage/trim-input.js
@@ -41,9 +41,20 @@ define([
41
* @private
42
*/
43
_trimInput: function () {
44
- var input = this._getInputValue().trim();
+ // Safari caret position workaround: storing carter position
45
+ var caretStart, caretEnd, input;
46
+
47
+ caretStart = this.options.cache.input.get(0).selectionStart;
48
+ caretEnd = this.options.cache.input.get(0).selectionEnd;
49
50
+ input = this._getInputValue().trim();
51
52
this.options.cache.input.val(input);
53
54
+ // Safari caret position workaround: setting caret position to previously stored values
55
+ if (caretStart !== null && caretEnd !== null) {
56
+ this.options.cache.input.get(0).setSelectionRange(caretStart, caretEnd);
57
+ }
58
},
59
60
/**
0 commit comments