mapbox / mapbox/mapbox-gl-js

Popup flickers and fails to stay open with defined offset near top of map

Open
#13,201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

There is an issue with popups that have a defined offset when the marker is near the top of the screen. Specifically, when a marker has a defined offset (e.g., -40 in y), the popup flickers and fails to stay open because the popup appears in front of the marker, causing the hover to be lost. This triggers the mouseout event, causing the popup to close and reopen rapidly.

Steps to Reproduce

  1. Create a marker near the top of the map.
  2. Define a popup with an offset (e.g., -40).
  3. Hover over the marker.

Expected Behavior

The popup should open and remain open while the mouse is hovering over the marker or the popup.

Actual Behavior

The popup flickers and fails to stay open because the popup appears in front of the marker, causing the hover to be lost. This triggers the mouseout event, causing the popup to close and reopen rapidly.

See the video for a demonstration

https://github.com/mapbox/mapbox-gl-js/assets/99763883/2b6e9211-fa20-4608-942e-03f8abc110ed

Suggestion for Improvement

It might be helpful to dynamically set the offset to 0 when the popup opens towards the bottom. This could prevent the popup from appearing in front of the marker and losing the hover state.

Implementing this fix would greatly improve the user experience by preventing popup flickering and ensuring that popups remain open when the user hovers over the marker or the popup itself, even with a defined offset. Thank you for considering this bug report!

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 marker-and-popup case near the top of the map with a negative offset such as -40, then trace the popup hover and mouseout behavior. Done means the popup remains open while the pointer is over the marker or popup and no longer flickers or rapidly reopens.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.