mapbox / mapbox/mapbox-gl-js

Prevent draggable marker touch event propagation

Open
#9,755 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

**mapbox-gl-js version**: v1.9.0

### Question

I'm using Mapbox in a Facebook Messenger chatbot which renders the map inside an HTML webview. When dragging a draggable marker, the `touchmove` event also gets propagated to the parent webview. This then moves it up and down. I can't immediately see a way to get the event in the drag handlers so that I could call `event. stopPropagation()`.

Here's an example of the issue:

![mapbox-messenger](https://user-images.githubusercontent.com/1965510/83686993-0e0b4400-a5e3-11ea-99ad-f080d71de393.gif)

Is there an accepted method to achieve this?
Can I get access to the events in the drag handlers or is there a better way to do this?

Thanks!

### Links to related documentation

https://docs.mapbox.com/mapbox-gl-js/api/markers/#marker-events

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 Marker events documentation linked in the issue and trace the draggable marker touch and drag handlers. Reproduce the touchmove propagation in the Messenger webview, then verify that dragging a marker no longer moves the parent webview without breaking marker dragging.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.