mymth / vanillajs-datepicker

A vanilla JavaScript remake of bootstrap-datepicker for Bulma and other CSS frameworks
MIT License
720 stars 147 forks source link

Unwanted trigger #111

Open silency opened 2 years ago

silency commented 2 years ago

Hello, Each time i trigger a JS function, it open the datepicker popup. Any idea ? Like in a simple form, i choose a date with datepicker, i fill 4 or 5 input text, and i choose a picture in a inputfile, when i select my picture and come back on form the popup datepicker is triggered :( Thanks !

mymth commented 2 years ago

I guess the datepicker's input field is receiving the focus after selecting a picture in the file input field for some reason. (maybe the date input is the first input element of the form?)

silency commented 2 years ago

Hello, that's it, it is the first element of the form, have you any solution ?

mymth commented 2 years ago

How to solve it depends on how your form is made. It seems like you have something that moves the focus automatically to the first input of a form when a file is selected or the form or its parent is shown/focused. You may need to disable it.