beholdr / maska

Simple zero-dependency input mask for Vue, Svelte, Alpine.js and vanilla JS.

Home Page:https://beholdr.github.io/maska/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`eager: true` break the mask

mrleblanc101 opened this issue · comments

Describe the bug

Be this mask:

telMask: {
    mask: (val) => (val.startsWith('1') ? '1 (###) ###-####' : '(###) ###-####'),
    eager: true,
},

Typing 1 should results in 1 ( but results in 1 (1
Then, if you type a full mask, you can't delete !
2023-02-03 10 50 49

The mask break when you try to delete any caracter that was added by eager: true.
Another exemple where I added eager: true so that the space would be automatically added.

Be this mask:

postalMask: {
    mask: '@#@ #@#',
    eager: true,
    tokens: {
        '@': { pattern: /[a-zA-Z]/, transform: (chr) => chr.toUpperCase() },
    },
},

2023-02-03 11 08 20

Could you please provide online sandbox with this example? I can’t reproduce this case

Thanks, confirmed in Chrome, but not in FF. Will check.

Should be fixed in v2.1.7