Skip to content

Caret position incorrect after paste with prefix and separator mask #1571

@BobMakhlin

Description

@BobMakhlin

🐞 bug report

Is this a regression?

No

Description

When pasting a decimal number into an input with mask="separator.2" and a prefix, the caret is placed before the last digit instead of at the end of the value. Without a prefix the problem does not occur.

Example: paste 123.45 into the input; prefix = $
Actual result: After pasting 123.45, the caret is placed before the last character: $123.4|5

🔬 Minimal Reproduction

https://stackblitz.com/edit/stackblitz-starters-o4dbhpbs?file=src%2Fmain.ts

🌍 Your Environment

Angular Version:


   _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 20.0.0
Node: 20.19.1
Package Manager: npm 10.8.2
OS: linux x64

Angular: 20.0.0
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2000.0
@angular-devkit/core         20.0.0
@angular-devkit/schematics   20.0.0
@schematics/angular          20.0.0
rxjs                         7.8.2
typescript                   5.8.2
zone.js                      0.15.0
   

Ngx-mask version: 20.0.3

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