Skip to content

Selection replacement loses mask layout when using keepCharacterPositions #1527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
CastenHave opened this issue Apr 8, 2025 · 1 comment

Comments

@CastenHave
Copy link

🐞 bug report

Is this a regression?

No

Description

The mask format is lost when a part of the text is selected and new numbers are typed in. This happens when keepCharacterPositions is set to true together with showMaskTyped set to true. The expected result is that the numbers that are set to placeholderCharacter.

🔬 Minimal Reproduction

See the mask demo of keepCharacterPositions.
https://jsdaddy.github.io/ngx-mask/#7
Fill in 111-222-333, select 222 in the middle and start type a 4. The input now loses the given mask format. The expected result would be 111-4__-333 but now it shows 111--433.

🌍 Your Environment

Angular Version:
"@angular/core": "^19.2.1",

@emelamud
Copy link

Having the same problem, selecting several characters and pressing DEL breaks the mask, see example here -- https://stackblitz.com/edit/stackblitz-starters-kms52rxa?file=src%2Fmain.ts

Angular version is 19.0.6, ngx-mask version is 19.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants