mapbox / mapbox/mapbox-gl-js

Popup auto-anchoring should account for global padding

Open
#11,841 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 2.8.2

**browser**:

### Steps to Trigger Behavior

1. Add a popup to the map
2. Set a global padding `map.setPadding`
3. (for testing) `map.showPadding = true`
4. Pan the map so the popup intersects the padding

### Link to Demonstration

https://codepen.io/andrewharvey/pen/jOZOXGm

### Expected Behavior

The auto anchoring of the popup should treat the padding similar to the map edge and re-anchor if it has space.

My reasoning is that global padding is usually set so that content is only shown in the background in that padded area and no focused content should appear there, though it probably does depend on what people are using padding for.

### Actual Behavior

The popup will overflow into the global padding and only re-anchor on the map edge.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior using the linked CodePen with mapbox-gl-js 2.8.2; start at the popup auto-anchoring behavior and its interaction with map.setPadding. Done means the popup treats global padding like the map edge and re-anchors when there is room, rather than overflowing into the padded area.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.