Skip to content

Commit 199a5c5

Browse files
committed
Fix main page horizontal scroll caused by Leaflet z-index override
The previous fix overrode .leaflet-pane z-index to 1, which broke Leaflet's internal pane stacking (tiles, markers, popups need z-indices 200-700). This caused the map to render incorrectly and push content far beyond the viewport width. Fix: removed the z-index override on individual panes. Instead, set z-index:0 on the .leaflet-container itself to keep the entire map below modals without breaking internal layout. Added overflow- hidden on the map wrapper div for extra safety.
1 parent 2c3ac7f commit 199a5c5

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

src/app/globals.css

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,10 @@ html.light .metric-card:hover {
249249
animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
250250
}
251251

252-
/* Ensure Leaflet map doesn't overlap modals */
253-
.leaflet-pane,
254-
.leaflet-top,
255-
.leaflet-bottom,
256-
.leaflet-control {
257-
z-index: 1 !important;
258-
}
259-
.leaflet-popup-pane {
260-
z-index: 2 !important;
252+
/* Contain Leaflet map within its parent — prevent overflow and z-index conflicts */
253+
.leaflet-container {
254+
z-index: 0;
255+
position: relative;
261256
}
262257

263258
/* Water flow animation */

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default function Dashboard() {
140140
<span className={`text-xs ${isDark ? "text-[#E5E7EB]" : "text-[#6B7280]"}`}>{t("section.map_network")}</span>
141141
</div>
142142
</div>
143-
<div className="h-[250px] sm:h-[350px] md:h-[550px]" aria-label="Interactive watershed map">
143+
<div className="h-[250px] sm:h-[350px] md:h-[550px] overflow-hidden rounded-2xl" aria-label="Interactive watershed map">
144144
<DCMap
145145
onStationSelect={setSelectedStation}
146146
selectedStation={selectedStation}

0 commit comments

Comments
 (0)