flowbite-datepicker icon indicating copy to clipboard operation
flowbite-datepicker copied to clipboard

Close not working using Rails 7 import maps and turbo version

Open ferrisoxide opened this issue 2 years ago • 0 comments

We're using datepicker.turbo via import maps (https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.0.0/datepicker.turbo.js) and are seeing some strange behaviour.

On refreshing a page - which should fire off the turbo:load event - the datepicker won't close on selection of a date (i.e when you click on it in the calendar popup). Even more interesting, clicking on a date in the calendar widget highlights the previously selected date (if you click around multiple times). The date in the text box is correctly updated, but the selected date is the old value.

Escape and clicking off the widget still works.

We've tried using version 2.2.0 of the datepicker.turbo pack with the same issue.

Could this be turbo cache related? Has anyone else seen anything similar?

~~Edit: we've also tried to manually reinitialize the datepicker elements elsewhere in our JS but can't seem to find an exported constructor.~~ Not core to the problem. The datepicker is being initialized, it just loses/changes behaviour after a page refresh.

ferrisoxide avatar Dec 13 '23 06:12 ferrisoxide