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

cancel event does not fired when copy: true #684

Open
PFight opened this issue Aug 31, 2021 · 1 comment
Open

cancel event does not fired when copy: true #684

PFight opened this issue Aug 31, 2021 · 1 comment

Comments

@PFight
Copy link

PFight commented Aug 31, 2021

Please only use GitHub issues for bug reports and feature requests.

  • Read the contributing guidelines
  • Bug reports containing repro steps are likely to be fixed faster
  • Feature requests should be multi-purpose, describe use cases
  • For support requests or questions, please refer to our Slack channel

Repro steps:

  1. Open second sample on https://bevacqua.github.io/dragula/ (with events)
  2. Change dragula([$('left-events'), $('right-events')]) to dragula([$('left-events'), $('right-events')], { copy: true }), and add subscription to 'cancel' event
  3. Try to drag last item in the left column bit lower in bounds of its container and release - no cancel event raised

Reason: _copy is not in the dom, so getParent(_copy) returns null, and then isInitialPlacement returns false, and we go to drake.emit('drop', item, null.

image

Because of this bug there is no way to distinguish two situations:

  1. Item was moved out of the container
  2. Item moved inside the container

In the second case we should get 'cancel' event, but actually, in both cases we get 'drop" event with target = null.

@PFight
Copy link
Author

PFight commented Sep 13, 2021

Fixed in temporary package dragula-fixed

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