imaskjs
imaskjs copied to clipboard
Dynamic masks: error throwing when overflow value
Hello!
Describe the bug If you specify the maximum length value in the dynamic mask, and then try to enter another some character, an error will occur
To Reproduce
- Go to https://imask.js.org/guide.html#masked-dynamic
- Click "demo"
- Open browser console
- Write some max length value (ex: 000000000)
- Move cursor to some place before end
- Write "0" again
- See error
Expected behavior imask prevents entering unavailable values in the field and the error does not occur if you try to do this
Environment:
- OS: macOS
- Browser: Firefox 97.0.1, Chrome 96.0.4664.55
- IMask version: 6.4.2
- Framework/plugin: no
Error example

This bug can be fixed with pattern.js changing with line of 288 from
const blockDetails = block._appendChar(ch, { ...flags, _beforeTailState: flags._beforeTailState?._blocks[bi] });
to const blockDetails = block._appendChar(ch, { ...flags, _beforeTailState: flags._beforeTailState?._blocks?.[bi] });
fixed, will be released soon
Thank you.