RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.4k stars 2.17k forks source link

Wrong cursor placement with numeric mask and suffix #1880

Open rchesnokov opened 6 years ago

rchesnokov commented 6 years ago

When using numeric extensions with alias: numeric and suffix option, cursor gets placed in the wrong position on subsequent input focusing.

Check this fiddle: https://jsfiddle.net/rchesnokov/pvovk5r4/

Reproducing: 1) Focus the input 2) Type something or don't (it doesn't matter), then focus out 3) Focus the input again.

Cursor should be moved to the left from suffix, but it gets stuck on the right side, and you can't type anything in that position. From now on it's movable only with keyboard arrows and it also shouldn't allow user to move through parts of the suffix (like u can move cursor between whitespace and $ sign).

Tested on Chrome65 and Inputmask ver. 3.3.11 and 4.0.0-beta.54. (Both are bugged)

Edit: on more testing i see, that disabling groupSeparator option somewhat fixes the bug, but it works only until i hit backspace to delete a number, after that it breaks again as described above.

vsn4ik commented 6 years ago

A similar problem on 4.0.1-beta.12. Perhaps a mistake was made here https://github.com/RobinHerbots/Inputmask/commit/c52d1adbdc060cc803dcb9de8c6ca489b7c60c41

vsn4ik commented 6 years ago

Fixed in 4.0.1-beta.15