Inputmask icon indicating copy to clipboard operation
Inputmask copied to clipboard

Scroll to input on form submit with required field

Open ExileofAranei opened this issue 5 years ago • 2 comments

Hello, thanks for this great plugin, but faced a bit strange behavior. Submitting form with required empty input value that uses inputmask will set focus on it. But starting to scroll page immediately after element gets focused, after some time page scrolls to focused element again. How to reproduce: open link below, left form is bugged (maybe its not a bug, but I couldn't find any option to disable this behavior). Do not input anything and just press "submit" button. Element becomes focused and right after it immediately start to scroll page down, then after some delay page scrolls back to focused element. Right form without inputmask input works as expected and do not have this strange scroll. I created a demo sandbox: https://jsfiddle.net/vj5aq9r7/ Inputmask version: 5.0.6-beta.17 Browser: Chrome 85.0.4183.121 (Official Build) (64-bit)

ExileofAranei avatar Oct 02 '20 16:10 ExileofAranei

Also faced a problem with focus event, seems like this is also related to the first one. I've created a one more sandbox: https://jsfiddle.net/exileofaranei/usm04htc/12/ On submitting form required empty input with enabled inputmask lost focus and then after some delay get focus back, but placeholder keeps being visible. At demo fiddle i've made a float label over input. Its floating above while input is focused. How to reproduce: open link, do not type anything to inputs and press two submit buttons to see difference. Tried to downgrade inputmask to 4.0.9 version and it works like expected, so the problem exists in 5.0.0 and above versions. Inputmask version: 5.0.6-beta.19

ExileofAranei avatar Oct 21 '20 23:10 ExileofAranei

@ExileofAranei When initializing, pass the property validationEventTimeOut: 0. Example: $('#test11').inputmask({ mask: "99999-99999", showMaskOnHover: false, validationEventTimeOut: 0, });

https://robinherbots.github.io/Inputmask/#/documentation#validationeventtimeout

bubblesortt avatar Sep 16 '23 12:09 bubblesortt