Drag outside of browser window in Firefox
typescriptguru opened this issue · 1 comments
typescriptguru commented
- My issue title starts with
Drag outside of browser window in Firefox
- I have read the README, especially the 'classic blunders' section, and the dragula docs.
- I have searched through the
ng2-dragula
issues for related problems, including closed issues. - I have browsed through the issues labeled "future reference" for problems that have been solved before or have a known workaround.
- I am using the latest version of
ng2-dragula
.
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:
- Drag any draggable content outside of browser,
- Release the mouse (mouseup)
- Enter mouse into the Firefox browser again.
- 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 commented
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