fix: map attribution starts collapsed — stop overlapping the planner sheet (#33)#42
Merged
Conversation
MapLibre 5.x's compact AttributionControl always enters the DOM expanded (_updateCompact adds maplibregl-compact-show together with maplibregl-compact the moment the first attribution string arrives) and only the first map drag collapses it — the "renders collapsed under 640px at add time" behavior assumed in the issue does not exist in 5.x. Below the 1024px breakpoint the expanded ~600px bar overlays the bottom sheet and intercepts pointer events aimed at the full-width "Route planen" button. MapView now swallows that one-shot auto-expansion in the bottom-sheet layout: a MutationObserver on the control's class attribute reproduces upstream's own drag-collapse (_updateCompactMinimize — remove maplibregl-compact-show, nothing else) in a microtask, before the expanded bar can paint. Only documented CSS-contract classes are touched; the toggle button keeps working, so the attribution stays one tap away (CC-BY/ODbL: collapsed-but-expandable is compliant). Wide layouts keep upstream behavior — nothing overlaps the map column there. plan.spec.ts drops the unconditional collapse-click workaround (PR #32 review Finding B) and asserts the fixed contract instead: collapsed on load at phone width, expandable + re-collapsible by tap, and the plan click landing with NO collapse click as the interception regression guard. MapView.test.ts covers the helper's one-shot, wide-gate, and disposer semantics; App.test.tsx's FakeMap gains getContainer() (file also picked up formatter-hook reformatting). Closes #33 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…review r1) Review round 1, two accepted Minors: 1. Drop the load-time wide-layout media-query gate: it was read once at map creation, so a session loaded at >=1024px and then narrowed kept the expanded bar overlapping the sheet. The one-shot collapse now runs at every viewport width (helper renamed collapseAttributionUnderBottomSheet -> collapseAttributionAtLoad); collapsed-but-expandable is CC-BY/ODbL-compliant in both layouts. The wide-gate unit test becomes an always-collapse pin (re-adding a gate must fail it). 2. plan.spec.ts part-3 comment overstated the guard: part 2 re-collapses the attribution before the plan click, so part 1's load-state class assertion is the primary regression guard and part 3 is belt-and-suspenders. Comment only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lens round) Accepted lens findings, item by item: 1. App.test.tsx: revert the whole-file prettier reflow (format-on-edit hook churn; prettier is not in the CI gate and the reflow maximized conflict surface with feat/38-39) — keep ONLY FakeMap.getContainer(). Reapplied from main via git apply so the diff vs main is the single 5-line hunk. 2. MapView.test.ts: test name drops the "review round 1" process reference. 3. MapView.tsx: "documented CSS contract classes / stable styling API" softened to "CSS classes MapLibre itself ships styles for in maplibre-gl.css (a de-facto-stable surface; no JS internals)" — MapLibre nowhere documents its class names as public API. 4. MapView.tsx: CC-BY/ODbL compliance claim attributed as the position #33 accepted, noting upstream's compact docs recommend not collapsing where the bar fits and why the wide layout trades that. 5. MapView.tsx: expansion persists until first drag OR a toggle tap (both run the collapse path), not "only the first map drag". 6. MapView.test.ts: "re-adding a gate must fail this test" scoped to the wide-skip polarity; other matchMedia gates crash the un-stubbed tests instead (jsdom has no matchMedia). 7. MapView.tsx: control enters compact mode expanded — it enters the DOM empty/non-compact at onAdd; compact+show arrive with the first attribution string. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
DocGerd
commented
Jul 16, 2026
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.
On narrow screens the MapLibre attribution loaded as an expanded ~600 px bar overlapping the bottom sheet — it intercepted taps aimed at the "Route planen" button (the primary on-boat flow, degraded since #24 moved e2e coverage to phone width and exposed it).
Closes #33
Root cause (established against maplibre-gl 5.24 source)
The issue's premise — "compact attribution renders collapsed under 640 px at add time" — is outdated for MapLibre 5.x:
_updateCompact()always starts the compact control expanded (open+maplibregl-compact-show) the first time attributions become non-empty; the only upstream auto-collapse is bound to map drag, and the expansion is strictly one-shot. There is no configuration option for start-collapsed.Fix
collapseAttributionAtLoad()in MapView: a MutationObserver on the control's class attribute removesmaplibregl-compact-showonce, as a microtask — before first paint — exactly mirroring upstream's own drag-collapse (leavesopenas drag-collapse does). It runs at every viewport width (review round 2 dropped an initial wide-layout gate: a session loading wide then narrowed would have kept the overlapping bar; collapsed-but-expandable is CC-BY/ODbL-compliant in both layouts). After the one-shot it disconnects — a user who expands stays expanded; disposer on unmount; touches only the stable public CSS-contract classes, so a future upstream rename degrades gracefully to the old expanded bar, never breakage.Honest e2e coverage restored (review Finding B from #32)
plan.spec's unconditional collapse-click workaround is removed. The spec now asserts the contract: attribution collapsed at load on the phone viewport (the primary regression guard — it fails if the fix is removed), expandable by tap with the full notice visible and re-collapsible (license-compliance proof), and the "Route planen" click landing with no collapse click.
Verification
🤖 Generated with Claude Code