Skip to content

fix: prevent bottom-left layer control from overlapping attribution - #267

Open
nbali with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-bottom-left-layer-control
Open

nbali with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-bottom-left-layer-control

Conversation

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

On narrow screens, the multi-line Leaflet attribution can cover the bottom of the layer selector. The fix mirrors the attribution height into a CSS variable and offsets the bottom-left control stack accordingly.

  • Runtime measurement
    • Observe attribution size changes with ResizeObserver.
    • Update --attribution-height on the map container.
  • Control positioning
    • Apply the variable height to .leaflet-bottom.leaflet-left.
new ResizeObserver(() => {
    map.getContainer().style.setProperty(
        '--attribution-height',
        attribution.offsetHeight + 'px'
    );
}).observe(attribution);

Copilot AI and others added 2 commits September 19, 2026 14:27
Co-authored-by: nbali <581927+nbali@users.noreply.github.com>
Co-authored-by: nbali <581927+nbali@users.noreply.github.com>
@nbali
nbali marked this pull request as ready for review September 19, 2026 14:30
Copilot AI lite review requested due to automatic review settings September 19, 2026 14:30
@nbali
nbali marked this pull request as draft September 19, 2026 14:31
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Sp3EdeR.github.io/huroutes/pr/pr-267/

Built to branch gh-pages at 2026-09-19 14:31 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified, and the review supports approval.

Review effort: Lite
Findings: None

What changed in this PR

Prevents Leaflet’s bottom-left controls from overlapping multi-line attribution on narrow screens.

Changes:

  • Tracks attribution height with ResizeObserver.
  • Offsets bottom-left controls using a CSS variable.
File Description
res/​huroutes.js Updates the attribution-height CSS variable dynamically.
res/​huroutes.css Applies the variable to bottom-left Leaflet controls.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nbali nbali changed the title Prevent bottom-left layer control from overlapping attribution fix: prevent bottom-left layer control from overlapping attribution Sep 19, 2026
@nbali
nbali marked this pull request as ready for review September 19, 2026 14:32
@nbali
nbali enabled auto-merge (squash) September 19, 2026 14:33
@nbali
nbali requested a balanced review from Copilot September 19, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused changes correctly adapt control positioning as attribution height changes.

Review effort: Balanced
Findings: None

Comment thread res/huroutes.css
}

/* Keeps the bottom-left controls above the variable-height attribution (see initCtrls) */
.leaflet-bottom.leaflet-left {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selector looks too brittle to me. Please update to this to make sure it applies to all bottom-placed controls except the one that has attribution, but controls only:

.leaflet-control-container .leaflet-bottom:not(:has(.leaflet-control-attribution))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this break the UI as it would apply on the right as well?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it has :not(:has(.leaflet-control-attribution)), so it doesn't apply this for any controls that have an attribution within

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.

4 participants