RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.4k stars 2.16k forks source link

State of alternator not reset with `clearIncomplete = true` #2712

Closed fanste closed 1 year ago

fanste commented 1 year ago

Tested using 5.0.9-beta.6 JSFiddle: https://jsfiddle.net/mxLs0eqj/2/

Input is configured with

Inputmask({
    // complex alternator mask as optional is working as expected
    mask: '(*-******)|(*-******-**)|(*-******-**-**)|(*-******-**-**-**)|(*-******-**-**-**-**)|(*-******-**-**-**-**-***)',
    clearIncomplete: true,
    keepStatic: true
})

If you type in 12345678 to get to the second mask and then leave the input, the input is cleared, Thats OK. image

But then you can't enter a value matching the first mask until backspace is pressed. The internal state only then seems to be cleared as well and the input still expectes a value matching the second (or higher) mask. A value matching the first mask is always rejected and cleared again. image.

fanste commented 1 year ago

A not so nice workaround is to add:

, onincomplete: function() {
    this.inputmask.setValue('');
}
RobinHerbots commented 1 year ago

@fanste ,

I pushed 5.0.9-beta.7

fanste commented 1 year ago

Same behavior as before. The changes in beta.7 do not fix this issue.

RobinHerbots commented 1 year ago

Hmm, isn't this a caching issue?

RobinHerbots commented 1 year ago

https://jsfiddle.net/bnom37d0/1/

fanste commented 1 year ago

No, unfortunately it isn't a caching issue. I just tried in on your jsfiddle and even reloaded the page with Strg+F5.

RobinHerbots commented 1 year ago

@fanste ,

You were right. I pushed version 5.0.9-beta.9 which should fix it. Can you have a try.

fanste commented 1 year ago

Bug is fixed with the new version. Thanks!