Skip to content

Paste working differently on mask with 0 or 9, it stop at first space for the 9 #1585

@gboutte

Description

@gboutte

🐞 bug report

Is this a regression?

No

Description

If I use a mask with only number 99999999999999 and I paste a number with space in it, example :
123 456 789 123 45, the field will only contain 123, everything after the first space is lost.

But if you use the mask 00000000000000 and you copy paste the same text, every number is included, the spaces are just removed.

Is it intended ?

The problem origin seem to be in the ngx-mask-applier.service.ts:728. This make the processing stay at the first space.

For example with 123 456 789 123 45, it will handle the 1, 2,3 then when it the turn, it will stay on the array 4th element until the end.

🔬 Minimal Reproduction

You can create two inputs and then try to copy and paste 123 456 789 123 45

<input type='text'  mask="00000000000000">

<input type='text' mask="99999999999999" >

Here is a stackblitz:
https://stackblitz.com/edit/stackblitz-starters-9mr8nqnz?file=src%2Fapp.component.ts

🌍 Your Environment

Angular Version: 18 on my project, and 20 on the stackblitz


@angular-devkit/architect       0.1802.14
@angular-devkit/build-angular   18.2.14
@angular-devkit/core            18.2.14
@angular-devkit/schematics      18.2.14
@angular/cdk                    18.2.14
@angular/cli                    18.2.14
@angular/ssr                    18.2.14
@schematics/angular             18.2.14
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.10
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions