A history restore swaps in htmx's snapshot of the body, which carries a
lifeless copy of AirDatepicker's global container. The previous fix looked
the container up by id, found that copy, and left the library's real
container detached, so pickers opened into nothing.
Track the container through datepicker.$container instead, remove any
snapshot copies after a swap, and reattach the real one when detached.
The filter on the Monthly and All pages is wrapped in hx-preserve, so a
boosted navigation keeps its pickers instead of recreating them. The
AirDatepicker global container they render into lives on the body and is
swapped out with it, leaving those pickers drawing into a detached node.
After each swap, move the detached container's pickers into the new
container, or reattach it when no new picker created one.
Navigating back while a mobile picker was open reattached its overlay still
active, leaving the page covered by an overlay nothing could close. Also skip
the reattach when the global container doesn't exist yet.
On touch devices AirDatepicker opens pickers in mobile mode, which closes
them through a shared overlay rather than on blur. The library keeps that
overlay in its module scope, inside a global container appended to the
body. Boosted navigation swaps the body, so the container and overlay are
removed: the library notices the missing container and builds a new one
for the next picker, but keeps reusing the detached overlay. From then on
nothing receives the outside click, and an open picker stays on screen
over the form until the page is fully reloaded.
Create every picker through a helper that remembers the overlay and moves
it back into the current global container whenever it was left detached.
Fixes#227