This is related to #87 but more technical. Currently nested drag sources will activate together. This is a very, very wrong behavior. Child drag source should _always_ prevent parent from activating.
But it's not as simple as it seems with HTML5 backend.
I tried adding e.stopPropagation()
into dragstart
handler, but there's another issue. Suppose List
and Card
are both drag sources, Card
is inside of List
. Suppose Card
has canDrag(): false
. We can't call stopPropagation()
in this case, because that would prevent the event from reaching the parent.
Okay, let's instead add if (DragOperationStore.isDragging()) return;
to dragstart
handler. But there's another problem: even though event now has reached the parent, if you actually drag, browser will use the original (child) target as drag preview.
This is probably solvable by explicitly using this.getDOMNode()
as dragPreview
if it's not specified in beginDrag
, so that the drag preview is guaranteed to be the current target. I haven't tried it yet. Either way, this doesn't seem like a complex issue, and is up for grabs!
Certainly we need some constraints on the dragPreview
Like what?
Fixed in 0.9.2.
Live demo: http://gaearon.github.io/react-dnd/#/nesting-sources
Is there a solution to stop calling parent when the canDrag
function return false
?
Most helpful comment
Is there a solution to stop calling parent when the
canDrag
function returnfalse
?