mapbox / mapbox/mapbox-gl-js

When map div has content at init, layer mouseenter zone gets offset

Open
#9,467 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

- We have a map div which has some noscript text at init ("JavaScript must be enabled")
- We create a MapBoxGL JS map in that div, overwriting the noscript
- We add a GeoJSON as a circle layer
- We use a mouseenter event to trigger a popup as recommended in the docs

In MapBoxGL 1.9.0, I couldn't hover over the marker; the mouseenter/mouseover zone is shifted down ~15 pixels, apparently due to that initial noscript text.
I have a demo here: https://mggg.github.io/covid-flows/index_mb.html?4

Before trying removing that noscript, I downgraded to 1.8.0 and the map worked again. It did not assume an empty div or remove the noscript text. So 1.9.0 appears to be handling these divs differently.

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

Start with the linked covid-flows demo and reproduce the hover offset in MapBoxGL 1.9.0, then compare it with 1.8.0 using a map div containing the reported noscript text. Trace the container and layer mouseenter behavior to identify the regression; done means the hover zone aligns with the circle layer without requiring an empty initial div.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.