beholdr / maska

Simple zero-dependency input mask for Alpine.js, Svelte, Vue.js and vanilla JS.

Home Page:https://beholdr.github.io/maska

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong cursor position when deleting/adding symbols not from the end of input

kitmurkit2 opened this issue · comments

Describe the bug

I noticed this bug in your demo for Money format: full via hooks. The cursor changes its position after a new comma sign is added/removed inside of the input.

Steps to reproduce

  • In your demo page open Money format: full via hooks
  • Type 1234567 // $1,234,567|
  • Then move the cursor after 3 // $1,23|4,567
  • Press backspace one time // $124|,567
  • The cursor changed its position and now will be after 4
  • Now after pressing backspace one more time 4 will be deleted // $12|,567

Actual result:

  • 3 and 4 were deleted

Expected result:

  • 2 and 3 should be deleted
  • The cursor must not change its position

Screenshots

image
image
image

Also, it does not opt-in the direction you specified by default

Thanks for report. Should be fixed in new v3.