alexkuz/react-input-enhancements

Mask component has some issues with selection

bloodyowl opened this issue · 3 comments

behaviour

  • Type 12
  • Move the caret between 1 and 2
  • Hit Backspace
  • The selection range is [1, 1]

expected

  • The selection range should be [0, 0]

Yeah, I'm aware of this - but I haven't found an easy solution. If I remember correctly, my attempts to fix it made the code much more complicated, so I left it as it is for now.

I'll try to make this work and send a PR if you want 🙂
At least supporting this case looks important, notably when you make a typo while writing a credit card number, if the user types without looking at the field, this can be really frustrating.

Sure, you're very welcome :) (for the other one as well, same story - I know about it, but I don't see an obvious solution)