dragula
dragula copied to clipboard
cancel event does not fired when copy: true
Please only use GitHub issues for bug reports and feature requests.
- [x] Read the contributing guidelines
- [x] Bug reports containing repro steps are likely to be fixed faster
- [x] Feature requests should be multi-purpose, describe use cases
- [x] For support requests or questions, please refer to our Slack channel
Repro steps:
- Open second sample on https://bevacqua.github.io/dragula/ (with events)
- Change
dragula([$('left-events'), $('right-events')])
todragula([$('left-events'), $('right-events')], { copy: true })
, and add subscription to 'cancel' event - 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
.
Because of this bug there is no way to distinguish two situations:
- Item was moved out of the container
- 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.
Fixed in temporary package dragula-fixed