Root elements in a nested layout, if all are removed and a new one is dynamically created, lose the handle setting
This code in src/index.js claims to "take care of new items added from Livewire during runtime".
if (directive.modifiers.includes('item-group')) {
// This will take care of new items added from Livewire during runtime.
el.closest('[wire\\:sortable-group]').livewire_sortable.addContainer(el)
}
However, it is for sub-sortable lists ('item-group'), not the root list. If instead the root list is emptied and then a new sortable.item is created, the plugin does not add the handle and the entire element is draggable.
I think a similar "take care" block is needed for the root elements, i.e. groups.
Sure i can confirm this same behavior, also if the initial list of items is empty and then elements are added.
@stillzombie Thanks for confirming. I still don't have a solution for this, other than forcing non-empty root elements to be added.
So for anybody having issues with the handle due a dynamic list when its get empty just add and if statement that only shows the ul when the list is not empty, and then there is not issue anymore with the handle. works nice so maybe this is not an issue @calebporzio
@stillzombie That may be so, however my reported issue was about nested lists (i.e. sortable lists which have sortable sub-lists inside each of them), not a single sortable list.