Dragging and dropping in Aurelia does not work

I am trying to create a drag and drop control for Aurelia. Initially, it works fine.

<div class="card" draggable="true" repeat.for="card of player2.hand">

However, when I pass the event to the listener dragstart, drag and drop no longer works.

<div class="card" draggable="true" dragstart.delegate="$parent.dragstart()" repeat.for="card of player2.hand">

I can fire the dragstart event, and the event has defaultPrevented: trueone that does not allow the drag and drop event to fire by default. How to disable preventDefaultevents for a specific delegate in Aurelia?

+4
source share
1 answer

This enhancement has been added. To disable defaultPrevented, return true from the event handler:

function dragStart() {
    // do stuff
    return true;
}

true, .

+5

All Articles