RobinHerbots / Inputmask

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

Problem with delete masked date on iOS #1899

Open machinek56 opened 6 years ago

machinek56 commented 6 years ago

Hi! I've tested released version of inputmask 4.0.0 with iPhone SE, iOS 11, and encountered such problem. When i set mask like so

new Inputmask('datetime', {
          inputFormat: 'dd.mm.yyyy',
          placeholder: '_',
          min: '01.01.1900',
          max: '12.12.2018',
          showMaskOnHover: false,
          showMaskOnFocus: true,
          clearMaskOnLostFocus: true
        }).mask(el)

i try to delete value from input, it deletes last digit, and omit further digits, and i have so strange behavior. Video. http://www.screencast.com/t/0KixFw2ZQi

PS: this example runs on Vue.js 2.5.16

RobinHerbots commented 6 years ago

@machinek56 ,

Can you also reproduce this on the demo page?

machinek56 commented 6 years ago

No, it doesn't reproduces on demo page.

http://www.screencast.com/t/9CJo5Xvg3

RobinHerbots commented 6 years ago

@machinek56 ,

Can you simulate it in as jsfiddle?

machinek56 commented 6 years ago

Robin, i've tried, but with no success. Throws in console Uncaught ReferenceError: require is not defined This fiddle i think will also reproduces this bug. https://jsfiddle.net/cvn2gfbL/

RobinHerbots commented 6 years ago

@machinek56 ,

https://jsfiddle.net/cvn2gfbL/1/

A simplified version. vue.js shouldn't matter.

machinek56 commented 6 years ago

Robin, i've tried - and it's not reproduces... hmm, what may causes this problem? Vue.js? http://www.screencast.com/t/hFaG95kP

RobinHerbots commented 6 years ago

@machinek56 , A jsfiddle with vue https://jsfiddle.net/cvn2gfbL/2/

With this one I can reproduce.

RobinHerbots commented 6 years ago

@machinek56 ,

It is an error in the dependencylib I think.

https://jsfiddle.net/cvn2gfbL/4/

RobinHerbots commented 6 years ago

@machinek56 ,

It is IOS specific

machinek56 commented 6 years ago

Yes, but what workaround would you suggest?

RobinHerbots commented 6 years ago

@machinek56 ,

I will push a fix as soon I got one.

https://jsfiddle.net/cvn2gfbL/6/ => this version works. Can you confirm

machinek56 commented 6 years ago

Yeah, on this fiddle it works as expected.

RobinHerbots commented 6 years ago

@machinek56 ,

Ok, I can reproduce the problem on the desktop now. I will push a fix soon.

RobinHerbots commented 6 years ago

@machinek56 ,

Have a retry with https://jsfiddle.net/cvn2gfbL/2/ this one failed before.

machinek56 commented 6 years ago

Robin, thanks a lot! Works as expected now. And also i found strange behavior when i deleting digits in the middle of date. Can you look at it? http://www.screencast.com/t/YBzr0DEocoKo

RobinHerbots commented 6 years ago

@machinek56 ,

I will also look at these.

vtarasenko commented 6 years ago

This bug come from min/max properties and was reported in issue #1808 - when changing or deleting some digits from the middle it causes the rest of the digits to shift to the location of the deleted digits and date becomes broken.