Originally described in https://www.drupal.org/project/farm/issues/3231161#comment-14308054: β
In the process of testing, I discovered another bug as well when trying to drag an item out of a parent and back into the root context ("All locations"). It works fine if you drag the item on top of the "All locations" item directly, but if you try to drag it NEXT TO an item under the "All locations" item (so that it is also a child of "All locations"), and then save, the item ends up under whatever parent item you dragged it NEXT TO.
I traced this with
console.log()
s and it seems to be an issue with Inspire Tree'snode.drop
event. In the situation described above, thetarget
node that you get intree.on('node.drop', function(event, source, target, index)
is NOT "All locations". It is the item you dragged it NEXT TO. Inspire Tree doesn't seem to return the correct target in that case.I found this old bug report which seems to have an important clue: https://github.com/helion3/inspire-tree-dom/issues/20
targetNode
is the node being targeted by the user"node being targeted" may mean "node that the item is next to" in this case.
This is a bit hard to trace currently because we are using UUIDs, so I tweaked the code locally to use asset IDs instead, and that makes it very clear what's happening. However, I can't find a good solution. It seems like a bug/limitation with Inspire Tree itself.
In the Locations hierarchy editor (/locations
) drag an asset so that it changes position relative to other assets in the same level (do not change its parent). Save. Reload the page. The asset is now a child of the asset it was moved next to.
This seems to be an upstream issue with Inspire Tree. I'm not sure what the right solution is.
TBD
Active
3.0
User interface
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.