Skip to content

fix(map): prevent theme CSS from collapsing circle-marker SVG to 0×0#69

Merged
techtimo merged 2 commits intomainfrom
fix/circle-marker-svg-zero-size
Apr 28, 2026
Merged

fix(map): prevent theme CSS from collapsing circle-marker SVG to 0×0#69
techtimo merged 2 commits intomainfrom
fix/circle-marker-svg-zero-size

Conversation

@techtimo
Copy link
Copy Markdown
Owner

Summary

  • Some themes apply svg { max-width: 100%; height: auto; } globally. Leaflet's renderer pane <div> is position: absolute with no explicit width, so 100% resolves to 0 — silently wiping out the width/height attributes Leaflet sets on the SVG. Circle markers (L.circleMarker) get clipped to nothing while polylines remain visible because they overflow their clipped SVG differently.
  • Fix: add .leaflet-pane > svg { max-width: none !important; } to neutralise the theme override.
  • Also moves the circle-dot renderer from markerPane to a dedicated spotmapCirclePane (z-index 450, between overlayPane 400 and markerPane 600), so circle markers render above polylines and are isolated from any pane-specific CSS targeting.

Diagnosis

DevTools on the affected page showed:

  • SVG width / height attributes correct (781, 600) — Leaflet JS was fine
  • getBoundingClientRect() returned width: 0, height: 0 — CSS was overriding to zero
  • Map container itself had correct dimensions (651×500) — not a hidden-container issue

Test plan

  • Build (npm run build) and install on a site using a theme with svg { max-width: 100%; height: auto; } (e.g. Twenty Twenty-One) — circle-dot track markers should now appear
  • Verify polylines still render correctly
  • Verify circle markers appear above polylines (z-index ordering)
  • Check no regression on local dev env where the issue was not reproducible

🤖 Generated with Claude Code

Some themes apply `svg { max-width: 100%; height: auto; }` globally.
Leaflet's renderer pane <div> is position:absolute with no explicit
width, so 100% resolves to 0 — wiping out the width/height attributes
Leaflet sets on the renderer SVG. Circle markers (L.circleMarker) are
clipped to nothing, while polylines remain visible because they overflow
their SVG differently.

Fix: add `max-width: none !important` to `.leaflet-pane > svg` in
custom.css so the SVG can expand to its Leaflet-set intrinsic width.

Also move the circle-dot renderer from markerPane to a dedicated
spotmapCirclePane (z-index 450) so circle markers render above
polylines and avoid any pane-specific theme overrides.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@techtimo techtimo merged commit bdb9ec9 into main Apr 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant