valor-software/ng2-dragula

Drag outside of browser window in Firefox

typescriptguru opened this issue · 1 comments

Describe the bug (required)

Drag is not canceled when user tries to drag content outside of browser and release mouse.
Only happens in Firefox browser.

To Reproduce (required)

Steps to reproduce the behavior:

  1. Drag any draggable content outside of browser,
  2. Release the mouse (mouseup)
  3. Enter mouse into the Firefox browser again.
  4. Then the content user just dragged still is being dragged even when you are not dragging anything.

Versions (required)

Please state which versions of the following packages you have installed:

  • @angular/core: [e.g. 6.0.4]
  • ng2-dragula: [e.g. 2.0.0]

Browsers affected (optional)

Firefox only

This is what I added after creating dragula group to fix this issue.

if (Utils.getBrowserInfo().firefox) {
  fromEvent(document, "mouseup").pipe(untilDestroyed(this)).subscribe((event: any) => {
    if (
      event.clientX < 0 || 
      event.clientY < 0 || 
      event.clientX > window.innerWidth || 
      event.clientY > window.innerHeight) {
        const cancelDrag = (group: Group) => {
          if (group.drake.dragging) {
            group.drake.cancel();
          }
        };
        cancelDrag(group);
    }
  });
}

So this ng2-dragula package should include above fix for Firefox