Ngx-mask: Pasting into masked input not working

Created on 14 Feb 2019  路  3Comments  路  Source: JsDaddy/ngx-mask

I think the following behavior is not intended. Here is a minimal stackblitz project to reproduce my case :

https://angular-t9hazm.stackblitz.io

There is a single input field with a simple mask 000.000.000
Pasting 123456789, the resulting string in field is correctly 123.456.789
Pasting 123.456.789, the resulting string in field is correctly 123.456.789
Pasting 123.a456.789, the resulting string in field is correctly 123.456.789
Pasting 123.aa456.789, the resulting string in field is incorrectly 123.456.78 (missing the final 9)
Pasting 123aa456789, the resulting string in field is correctly 123.456.789
Pasting aa123aa456aa789aa, the resulting string is incorrectly 123.456. (missing 9 digits)

Please note that all these inputs are giving the correct final 123.456.789 string if entering them character-by-character using keyboard.

Expected behavior : pasting into masked field should behave as if the characters were given one-by-one using keyboard (seems reasonable to me at least).

bug help wanted

All 3 comments

@Wisdomb33r Hi i have just tested your cases and everything work correct. Which version of ngx-mask do you use ? Could you provide your package.json and ngx-mask configuration

Hi @NepipenkoIgor
You can see my configuration here in my small stackblitz project to reproduce my problem. ngx-mask is : "ngx-mask": "^7.4.2"

I'm getting this behavior on both Edge and Chrome. No Firefox at work to test.

What do you have in the field if you paste aa123aa456aa789aa ? I'm getting 123.456 instead of 123.456.789.

@Wisdomb33r delete maxlength="12" and mask will work correct

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cabbott65 picture cabbott65  路  4Comments

tanjuyayak picture tanjuyayak  路  3Comments

ghost picture ghost  路  3Comments

dissy123 picture dissy123  路  3Comments

lramondev picture lramondev  路  3Comments