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

dnd5 - Counter badge shows up, although the drag was cancelled from dragStart callback #946

Closed
orenstuf opened this issue May 15, 2019 · 3 comments

Comments

@orenstuf
Copy link

In some situations I return false from the dragStart callback, to prevent dragging.
If the user tries to drag multiple nodes, the counter badge still shows up, and remains
visible after the drag have been cancelled.

@mar10
Copy link
Owner

mar10 commented May 15, 2019

Thank you for contributing! 👍

In order to process your issue, we need some more information, explanation what already was tried and/or concrete data.

A debuggable example (jsFiddle, Plunkr, CodePen, ...) may be helpful.

Please read the Contribution Guidelines for some hints on how to submit helpful feature requests and bug reports.

@orenstuf
Copy link
Author

orenstuf commented May 16, 2019

I have created a plunk to demonstrate the issue: https://plnkr.co/edit/dHTMlOJF46f8RSHrijrM
If you select two nodes and drag them, you will see the counter badge, although the drag is blocked by dragStart.

Notes:

  • Temporary fix: manually removing the badge (line 32 in plunk):
    $(node.span).find('.fancytree-childcounter').remove();

  • dragEnd is not fired, because the drag is blocked. Looking at the source code at
    dist/jquery.fancytree-all-deps.js, line 9594, I see that dragEnd is responsible for removing the badge:

case "dragend":
	_clearGlobals();
	// data.dropEffect = dropEffect;
	data.isCancelled = dropEffect === "none";
	$dropMarker.hide();
	// Take this badge off of me - I can't use it anymore:
	if ($extraHelper) {
		$extraHelper.remove();
		$extraHelper = null;
	}
	dndOpts.dragEnd(node, data);
	break; 

I'm using:

  • jquery 3.4.1
  • fancytree from dist/jquery.fancytree-all-deps.js, version 2.30.2
  • css from dist/skin-win8/ui.fancytree.css, version 2.30.2

@mar10 mar10 removed the waiting label May 17, 2019
@mar10
Copy link
Owner

mar10 commented May 17, 2019

Thank you for making up a sample.
I saw the problem there, and was not able to reproduce it with the latest code: the badge is not created when dragStart returns false. In this case also dragEnd is not called.

So I assume it is fixed with 2.31. It will be released the next days. Please re-openthis issue if it is not fix it for you then.

@mar10 mar10 closed this as completed May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants