JsDaddy / ngx-mask

Angular Plugin to make masks on form fields and html elements.
https://jsdaddy.github.io/ngx-mask
MIT License
1.16k stars 300 forks source link

Chrome, Unexpected behavior with input + mask #1311

Closed avrim-tr closed 7 months ago

avrim-tr commented 8 months ago

🐞 bug report

I use mask with input `<input mask="separator.2" [prefix]="somePrefix" thousandSeparator=","

input

    inputmode="decimal"
    type="text"
    formControlName="input" />`

And I see 2 things that are wired:

  1. When using the "prefix" input and the value to it change, the formControl notifies with same value again, even thought user did not touch or change it manually, this leads unwanted notifications from this
  2. When using [prefix] and when coming to delete in the input a "," nothing happens. On the other hand, when removing the [prefix] input and then try to remove ",", the current cursor moves one place to left, this seems like a bug. In general, should not ngmask allow to remove "," when user wants to do so?

Is this a regression?

No

Description

Written Above.

🔬 Minimal Reproduction

Stack blitz

🌍 Your Environment

*Angular Version:16*

andriikamaldinov1 commented 7 months ago

@avrim-tr Thanks for using Ngx-mask. Update to latest version fix backspace with prefix.

1) This behavior works as expected (bindind for property) in Angular

2) It example all work as expected - https://stackblitz.com/edit/stackblitz-starters-2ihqtf?file=src%2Fmain.ts