JsDaddy / ngx-mask

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

showMaskTyped with keepCharacterPositions causes problems with mask #1277

Closed TheNetStriker closed 10 months ago

TheNetStriker commented 10 months ago

🐞 bug report

Is this a regression?

I've not tested this in previous versions.

Description

When showMaskTyped is used together with keepCharacterPositions the masking characters will all be removed when all text is selected in the field. After this the masking does not work correctly anymore. When e.g. the first delimiter of the mask is reached I can not enter any more characters.

This is especially a problem when switching to the input field using the tab key because this always selects all text in the input field.

πŸ”¬ Minimal Reproduction

This can easily be reproduced on the demonstration page:

https://jsdaddy.github.io/ngx-mask/#6

πŸ”₯ Exception or Error

There is no exception or error.

🌍 Your Environment

Angular Version:


Angular CLI: 15.2.9
Node: 16.20.1
Package Manager: npm 9.6.4
OS: win32 x64

Angular: 15.2.9
... animations, cdk, cli, common, compiler, compiler-cli, core 
... forms, material, platform-browser, platform-browser-dynamic
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.9
@angular-devkit/build-angular   15.2.9
@angular-devkit/core            15.2.9
@angular-devkit/schematics      15.2.9
@schematics/angular             15.2.9
rxjs                            6.6.7
typescript                      4.9.5

Anything else relevant?

I've tested this with the latest Chrome and Firefox and both browsers have this problem.

andriikamaldinov1 commented 10 months ago

@TheNetStriker Thanks for using Ngx-mask. Please update to latest version. It example all work as expected - https://jsdaddy.github.io/ngx-mask/#6

TheNetStriker commented 10 months ago

@andriikamaldinov1 Thanks for fixing this. I'm still using Angular 15. Could you please also fix this problem in the Angular 15 version?