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

Copy&Paste of previous value after form reset isn't set value #1232

Closed ao1is closed 1 year ago

ao1is commented 1 year ago

🐞 bug report

Is this a regression?

I'm not sure

Description

  1. Define simple form with form control. Bind masked input to form control.
    public form = this.fb.group({
    inputValue: this.fb.control(undefined),
    });
    <input type="text"
       [formControl]="form.controls.inputValue"
       [mask]="'9999999999999'"/>
  2. Enter any value, e.g. '15'.
  3. FormControl's value set to 15.
  4. Copy entered value and reset form by calling form.reset()
  5. Value in input cleared.
  6. Paste copied value into input by Ctrl+V.
  7. Actual: FormControl's value set to null. Expected: FormControl's value set to pasted value.

🔬 Minimal Reproduction

Sample: https://stackblitz.com/edit/ngx-mask-copy-paste-bug Demo: https://www.screencast.com/t/xxN69caKI

🌍 Your Environment

Angular Version: 16.1.7 Chrome Version: 116.0.5845.188

andriikamaldinov1 commented 1 year ago

@ao1is Thanks for using Ngx-mask. Update to latest version. It example, all work as expected - https://stackblitz.com/edit/ngx-mask-copy-paste-bug-m6mo2b?file=src%2Fmain.ts