Skip to content

Commit ed50ca5

Browse files
committed
RadzenMask caret position kept during input
Fix #1529
1 parent 3e8eb1a commit ed50ca5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Radzen.Blazor/wwwroot/Radzen.Blazor.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ window.Radzen = {
5555
}
5656
return formatted;
5757
}
58+
59+
var start = el.selectionStart != el.value.length ? el.selectionStart : -1;
60+
var end = el.selectionEnd != el.value.length ? el.selectionEnd : -1;
61+
5862
el.value = format(el.value, mask, pattern, characterPattern);
63+
64+
el.selectionStart = start != -1 ? start : el.selectionStart;
65+
el.selectionEnd = end != -1 ? end : el.selectionEnd;
5966
}
6067
},
6168
addContextMenu: function (id, ref) {

0 commit comments

Comments
 (0)