RobinHerbots / Inputmask

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

Incorrect autofill of card with short expiry on android #2566

Open glacios opened 2 years ago

glacios commented 2 years ago

I have bank card form with expiry that has MM/YY mask. Due to that, I have to specify maxlength=5 for browser to understand that my format is not default YYYY/MM. Here is the discussion about this feature.

Given that saved expiry value is 10/2030, when I try to use autocomplete in chrome on desktop, field is filled correctly as 10/30. But chrome mobile fills input as 10/20. That happens because, for some reason, inputmask removes attribute maxlength from masked inputs in mobile browsers (in this line).

glacios commented 2 years ago

Used custom onBeforeMask as a workaround: https://jsfiddle.net/lazyfellow/r8cqwz51/23/