atlassian / pragmatic-drag-and-drop

Fast drag and drop for any experience on any tech stack
https://atlassian.design/components/pragmatic-drag-and-drop
Other
9.77k stars 223 forks source link

prevent event bubble #115

Open guaijie opened 2 months ago

guaijie commented 2 months ago

provide a way to prevent events from bubbling up

<Draggable
  className="drop-view"
  onDragStart="(v) => console.log('outer-drag-start:',  v)"
>
  <Draggable className="drag-item">1</Draggable>
  <Draggable className="drag-item">2</Draggable>
  <Draggable className="drop-view">
    <Draggable className="drag-item" onDragStart="(v) => console.log('inner-drag-start:',  v)"> 3</Draggable>
    <Draggable className="drag-item"> 4</Draggable>
  </Draggable>
</Draggable>

I want the child's onDragStart event to be triggered without the parent's onDragStart event being triggered at the same time, so that the parent event's behavior overrides the child event (because the child event fires first).