maska icon indicating copy to clipboard operation
maska copied to clipboard

caret position on dynamic mask

Open webdesignberlin opened this issue 2 years ago • 1 comments

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.

webdesignberlin avatar Nov 30 '21 12:11 webdesignberlin

+1

My workaround:

if (input.selectionEnd !== null && input.selectionEnd > val.length) {
    input.setSelectionRange(val.length, val.length);
  }

val contains the input without the suffix

pleqtron avatar Aug 03 '22 12:08 pleqtron

This helped me with another problem. I feel like this should be taken care of by the lib.

donnyv avatar Apr 18 '23 22:04 donnyv