mapbox / mapbox/mapbox-gl-js

Consider stopPropagation on Marker click when draggable is true

Open
#9,624 8 comments 0 reactions 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: 1.9.1

browser: any

playground at https://jsfiddle.net/g39b5n2c/

When a Marker is draggable, dragging the Marker by a few pixels or by zero pixels causes a map click event to fire (map click doesn't fire when dragging the marker by a larger distance).

While for static markers without any interaction, I think it's a reasonable default to let the click flow down to the map and let the developer choose to stop this when they like with

    marker.getElement().addEventListener('click', function (e) {
      e.stopPropagation();
    })

The question is when draggable is set, should we automatically stopPropagation on click to avoid a small drag also triggering a map click event, or should we leave as is and leave this to the developer?

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 JSFiddle playground and the Marker dragging and click behavior described in the issue. Determine whether draggable markers should stop propagation for clicks after small or zero-distance drags, then confirm the chosen behavior with an appropriate regression check; done means the behavior is intentional and documented by passing coverage.

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.