uNmAnNeR / imaskjs

vanilla javascript input mask
https://imask.js.org
MIT License
4.96k stars 258 forks source link

Cursor jump when `unmask={true}` #1053

Open maximeperraultdev opened 4 months ago

maximeperraultdev commented 4 months ago

Describe the bug Hi !

To Reproduce It happens when you type 0 at position 0, the mask changes and the caret move to last position. It doesnt happen when unmaskis set to false

unmask is set to true https://stackblitz.com/edit/react-dpvanv?file=src%2FApp.tsx,src%2Findex.js

unmask is set to false https://stackblitz.com/edit/react-vug3uy?file=src%2FApp.tsx

Expected behavior The cursor stays on current caret position when mask are changing

Environment:

Additional context Add any other context about the problem here.