question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

L.Draggable._dragging stuck

See original GitHub issue

How to reproduce

I have a temporary draggable markers that appear over a feature (on hover) and unless are dragged - I disappear them should the mouse hover away. Unless dragged, i.e.: unless they received ‘dragstart’. When i drag them real quick however (for some reason reproduces more easily on FF - seems slower) then the following happens:

  1. L.Draggable._onDown sets the global L.Draggable._dragging = true;
  2. mousemove reaches my code and at this point:
    • I haven’t received ‘dragstart’ yet.
    • the mouse is far enough for me to decide to remove the marker
  3. I remove the marker and L.Draggable._onUp is never called leaving L.Draggable._dragging rot in its sorry state forever.

Obviously the offending consequence is that nothing can be dragged ever. Understanding what’s cooking I have a workaround, so no rush with this.

To see for youself: https://playground-leaflet.rhcloud.com/qaha/1/edit?html,output

start dragging the marker and do not stop until it disappears. When it disappears the map is not draggable/panable.

What behaviour I’m expecting and which behaviour I’m seeing

I would expect the code be more resilient to this scenario - more specifically:

  • if a draggable is being removed amidst a drag it should clear L.Draggable._dragging

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
IvanSanchezcommented, Mar 7, 2017

@landonreed Please open a new issue, clearly explaining what you mean by “unintended” and “some issues I’m running into”. Reproducible examples, etc.

0reactions
landonreedcommented, Mar 7, 2017

@perliedman, I think this bug fix might cause unintended results for some users of Leaflet. Is my understanding correct that if the marker being dragged is changed while dragging the this reference will no longer equal L.Draggable._dragging and cause finishDrag to fire?

I’ve been working on updating to Leaflet 1.0.2 and think this bug fix is the source of some issues I’m running into. Should I open a new issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

L.Draggable._dragging stuck · Issue #5063 · Leaflet ... - GitHub
I have a temporary draggable markers that appear over a feature (on hover) and unless are dragged - I disappear them should the...
Read more >
Leaflet map marker dragging is not working properly on ...
I updated the codepen and added back the dragging: !L.Browser.mobile and it disables scroll on my mobile and lets me drag the marker....
Read more >
Dragging a draggable element out of a scrollable div - GSAP
The dragging gets initiated, but gets stuck and just stops. I'm not quite sure yet what's causing the error, but I'm going to...
Read more >
Mouse Gets Stuck in Drag Mode on Map : r/X4Foundations
Sometimes when I'm dragging the map around, the mouse won't release so that any movement keeps dragging the map even though I'm no...
Read more >
Leaflet map draggable marker events - GIS Stack Exchange
Edit: marker.on('click', L.DomEvent.stopPropagation); This partially fixes the bug. Now if I drag the marker VERY quickly and release it, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found