Popup is displayed at wrong position when multiple world copies are visible, even when the Popup is attached to the Marker
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 1.7.0
**browser**: Safari 13.1.1
### Steps to Trigger Behavior
Add Markers with attached `Popup`.
```javascript
// Add markers to the map
features.forEach(function (marker: any, i: number) {
const popUpContent = '
// Create the popup
const popup = new mapboxgl.Popup({ offset: 25 })
.setHTML(popUpContent)
.on('open', function (event: any) {
const activePoi = document.getElementsByClassName(poiId)[0]
activePoi.classList.add('active')
})
.on('close', function () {
const activePoi = document.getElementsByClassName(poiId)[0]
if (activePoi) {
activePoi.classList.remove('active')
}
})
let mark = new mapboxgl.Marker(markerElement)
.setLngLat(marker.geometry.coordinates)
.setPopup(popup)
.addTo(map)
})
```
Zoom out so multiple world copies are visible, and then open popup:

### Link to Demonstration
Example can be seen here: https://www.walleniuswilhelmsen.com/schedules
### Expected Behavior
Popup appears 25px above clicked Marker.
### Actual Behavior
Popup appears at wrong world copy.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue at the linked demonstration with multiple world copies visible, using a Marker with an attached Popup and setLngLat coordinates. Trace how Marker, Popup, setPopup, and addTo determine the popup's world copy; done means the popup appears 25px above the clicked Marker in the visible copy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100