From abb93c951178e2ce2a82460ff137797ed8c1f42f Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 30 Apr 2026 14:04:14 -0500 Subject: [PATCH] feat(weather): always-visible close button on weather detail panel --- assets/js/weather_map_hook.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/assets/js/weather_map_hook.ts b/assets/js/weather_map_hook.ts index dc05f2bc..993c3a6a 100644 --- a/assets/js/weather_map_hook.ts +++ b/assets/js/weather_map_hook.ts @@ -637,9 +637,7 @@ function buildDetailHTML(point: WeatherPoint): string { ] const mobile = isMobile() - const closeBtn = mobile - ? `` - : "" + const closeBtn = `` const handle = mobile ? `
` : "" @@ -737,6 +735,15 @@ export const WeatherMap: WeatherMapHook = { if (this.detailPanel) { L.DomEvent.disableClickPropagation(this.detailPanel) L.DomEvent.disableScrollPropagation(this.detailPanel) + + this.detailPanel.addEventListener("click", (e: MouseEvent) => { + if ((e.target as HTMLElement).closest(".detail-close-btn") && this.detailPanel) { + this.detailPanel.style.display = "none" + this.detailPanel.innerHTML = "" + this.clickMarker?.clearLayers() + if (this.escHint) this.escHint.style.opacity = "0" + } + }) } // ESC hint