I'm using SortableJS to make a drag-and-drop form builder, with three types/levels of draggable items: Sections, Questions, and Options. Sections can be dragged and reordered among one another, Questions can be dragged within their parent Section, or into another Section, and Options can be dragged within their parent Question or into another Question.
This is working correctly for the Sections and Questions, but not for the Options. Somehow even though the ondragstart
of the Option is firing, it immediately stops that event and instead triggers ondragstart
for the parent question.
I've tried e.stopPropagation()
within the Option's ondragstart
function, but it isn't really helping. It prevent's the parent Questions ondragstart
from firing, but it still isn't allowing the drag-and-drop sorting that Sortable is supposed to create. The Option becomes draggable and moves, but doesn't sort within its parent Question as it should
This is leading me to believe I have a problem with how I set up Sortable. Have I missed something obvious in the setup of the draggable area/items within Questions that I did correctly for Sections/Questions previously?
Fiddle: https://jsfiddle.net/robertgreenstreet/h8ocmL2p/4/
Code setting up the Sortable instance for Questions starts at line 105