imaskjs icon indicating copy to clipboard operation
imaskjs copied to clipboard

Dynamic masks: error throwing when overflow value

Open PurpleTape opened this issue 4 years ago • 1 comments

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

  1. Go to https://imask.js.org/guide.html#masked-dynamic
  2. Click "demo"
  3. Open browser console
  4. Write some max length value (ex: 000000000)
  5. Move cursor to some place before end
  6. Write "0" again
  7. 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 изображение

PurpleTape avatar Feb 23 '22 07:02 PurpleTape

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] });

keremkutlubay avatar Apr 22 '22 12:04 keremkutlubay

fixed, will be released soon

uNmAnNeR avatar Sep 13 '22 08:09 uNmAnNeR

Thank you.

keremkutlubay avatar Sep 13 '22 08:09 keremkutlubay