fix(map): prevent theme CSS from collapsing circle-marker SVG to 0×0#69
Merged
fix(map): prevent theme CSS from collapsing circle-marker SVG to 0×0#69
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
svg { max-width: 100%; height: auto; }globally. Leaflet's renderer pane<div>isposition: absolutewith no explicit width, so100%resolves to 0 — silently wiping out thewidth/heightattributes Leaflet sets on the SVG. Circle markers (L.circleMarker) get clipped to nothing while polylines remain visible because they overflow their clipped SVG differently..leaflet-pane > svg { max-width: none !important; }to neutralise the theme override.markerPaneto a dedicatedspotmapCirclePane(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:
width/heightattributes correct (781,600) — Leaflet JS was finegetBoundingClientRect()returnedwidth: 0, height: 0— CSS was overriding to zeroTest plan
npm run build) and install on a site using a theme withsvg { max-width: 100%; height: auto; }(e.g. Twenty Twenty-One) — circle-dot track markers should now appear🤖 Generated with Claude Code