Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag outside of browser window in Firefox #1019

Open
5 tasks done
typescriptguru opened this issue Sep 8, 2020 · 1 comment
Open
5 tasks done

Drag outside of browser window in Firefox #1019

typescriptguru opened this issue Sep 8, 2020 · 1 comment

Comments

@typescriptguru
Copy link

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

@typescriptguru
Copy link
Author

typescriptguru commented Sep 8, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant