RobinHerbots / Inputmask

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

unexpected behaviour for deciamls #1587

Open AndreySukhov opened 7 years ago

AndreySukhov commented 7 years ago

Hi there!

I'm using version 3.3.5

That's how I init plugin $.extend(Inputmask.prototype.aliases.currency, { prefix: '', groupSeparator: ' ', clearMaskOnLostFocus: true, radixFocus: false, positionCaretOnClick: 'none' });

(using mask for currency)

Typing 2 558.02 in input with mask, then move caret before first zero and trying to type any integer(for example 1) but nothing happens, is that correct behaviour? I would expect, that first 0 after digit changes to value i'm typing.

Thanks for your attention

mellonis commented 6 years ago

Hi there!

I've faced the same problem. I think that actual behavior is correct: user can't loose non-zero digits.

However, it would be great if new option for inputmask would be added. For example, it could be named 'allowToCorrectDecimals'. In this case there are two options what to do with 2 558.02 when a user presses key '1' when caret stands after radixPoint:

  1. 2 558.10
  2. 2 558.12 In my opinion the first option is more intuitive.

Could you pinpoint to the source code where this behavior is implemented? If I could add this functionality myself I would make a pull request then.