diff --git a/src/components/Map/useMapCore.js b/src/components/Map/useMapCore.js index 0ccd14a..d0b71b8 100644 --- a/src/components/Map/useMapCore.js +++ b/src/components/Map/useMapCore.js @@ -98,6 +98,15 @@ export function useMapCore(theme) { map.addControl(new maplibregl.NavigationControl(), "top-right"); mapRef.current = map; + // Close expanded post when clicking on the map (outside markers) + map.on("click", () => { + const el = expandedElRef.current; + if (el && el.__renderCompact) { + el.__renderCompact(); + expandedElRef.current = null; + } + }); + map.on("load", () => { const vp = getViewFromMap(map); setViewParams(vp);