I am trying to create a drag and drop control for Aurelia. Initially, it works just fine.
<div class="card" draggable="true" repeat.for="card of player2.hand">
However, when I delegate a listener to the dragstart
event, the drag no longer works.
<div class="card" draggable="true" dragstart.delegate="$parent.dragstart()" repeat.for="card of player2.hand">
I can get the dragstart event to fire and the event has defaultPrevented: true
, which keeps the default drag event from starting. How can I disable preventDefault
on a particular event delegator in Aurelia?
This enhancement has been added. To disable defaultPrevented
, return true from your event handler:
function dragStart() {
// do stuff
return true;
}
In this particular case, you need to return true to enable the default drag behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With