maska
maska copied to clipboard
caret position on dynamic mask
I love maska. I'm not sure if this behavior is intentional or a bug. from ux point of view, the following would be the expected behavior.
Reproduction Link: https://beholdr.github.io/maska/ (dynamic mask)
expected behavior: if i fill this input with one or multiple numbers, then I would expect that the cursor/caret is always at the end of the number just entered.
current behavior: the cursor/caret is always at the end of the mask.
+1
My workaround:
if (input.selectionEnd !== null && input.selectionEnd > val.length) {
input.setSelectionRange(val.length, val.length);
}
val
contains the input without the suffix
This helped me with another problem. I feel like this should be taken care of by the lib.