Inputmask icon indicating copy to clipboard operation
Inputmask copied to clipboard

Change event is not dispatched for particular keypress actions on currency mask.

Open niklaushug opened this issue 2 years ago • 0 comments

Bug

Some keyboard interactions on a field with a currency mask does not dispatch a change event. Hence new values are only reflected inside the field but cannot be sended to a backend.

  • If I change the value by pressing keys 0 to 9 a change event gets dispatched.
  • If I change the value by pressing k, m, ArrowUp and ArrowDown NO change event gets dispatched.

At least for keyboard interactions k, m, ArrowUp and ArrowDown a change event should be triggered somewhen.

You can see this behaviour on https://replit.com/@niklaushug/inputmask-does-not-dispatch-change-event-on-certain-keypress

Version 5.0.9-beta.39, 5.0.8 and more are affected by this error. I have no evidence that type of browser or operating system is relevant.

Reason

Proposed fix

Remove inputmask.undoValue = inputmask._valueGet(true); and rely on blurEvent to update undoValue.

See Pull Request 2758

Further thoughts

We may need a change event directly after keyboard interactions k, m, ArrowUp and ArrowDown, to ensure that the new value is saved even if the browser is closed before unfocus the field.

niklaushug avatar Nov 15 '23 11:11 niklaushug