Skip to content

Mask does not switch when input becomes incompatible mid-entry #2886

Description

@edumt

When using masks with overlapping valid prefixes, the initial branch selection works correctly on first input and when completing a mask. However, during typing, if the selected branch later becomes incompatible with the evolving input (while another mask would still be valid), the mask does not re-evaluate or switch branches.

I’m not entirely sure if this is a bug or expected behavior (or skill issue 😭 ), but it seems like the expected UX would be for the mask to switch dynamically when the input diverges from the currently selected mask.

In this example there are two masks:

Mask A: 11-digit numeric format
Mask B: 14-character format (12 uppercase alphanumeric characters + 2 digits)

Because both formats share compatible prefixes, initially Mask A is selected when the user starts typing numeric input. However, once Mask A is selected, the input becomes constrained by that mask. This prevents entering alphanumeric characters that would make the value invalid for Mask A but valid for Mask B:

The user starts typing numeric input → Mask A is selected
The mask “locks in” to Mask A
Alphanumeric input is blocked, even though Mask B would still be a valid match
Only after completing Mask A does switching become possible again


  • OS: Windows 11 25H2
  • Browser: Chrome Version 149.0.7827.115 (Official Build) (64-bit)
  • Inputmask version: 5.0.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions