Skip to content

use-mask-input@3.11.1

Choose a tag to compare

@eduardoborges eduardoborges released this 27 Jul 20:47
· 16 commits to main since this release
f075b0d

Patch Changes

  • 20230ee: fix: stop maxLength from blocking input on masked fields

    A mask like 999.999.999-99 keeps its literals and placeholder in the input's
    value, so maxlength counted characters nobody typed. The browser refused
    keystrokes, and inputmask copied the attribute into a validator that rejects any
    buffer longer than it. Any maxLength at or below the masked length rejected
    every keystroke, and larger values silently truncated.

    The attribute is now removed before the mask is applied, but only for masks that
    render characters on their own. Open-ended masks such as numeric, integer
    and decimal render nothing while empty, so their maxLength still caps
    exactly what it says it caps and is left untouched.

    Closes #191

  • 46fb75d: fix(react-hook-form): fire onChange on the first select-all + delete for predefined values

    When a React Hook Form field had a predefined value, the mask was applied before RHF wrote that value onto the element, leaving Inputmask's internal buffer out of sync with the DOM. The first Ctrl+A + Delete was swallowed and did not trigger onChange. The RHF ref now runs before the mask is applied, so Inputmask is seeded with the current value and stays in sync from the start.