react-complex-tree icon indicating copy to clipboard operation
react-complex-tree copied to clipboard

OnDrop returns not correct childIndex for target.targetType = 'between-items'

Open HannaHabr opened this issue 1 year ago • 0 comments
trafficstars

Describe the bug Hi! I understand that this could be intentional, but when I drop 'between-items' I don't get expected target.childIndex.

To Reproduce

  1. Create a tree with 3 items in the root, let's name them A,B,C. Enable reordering of items. Log target object in onDrop callback
  2. Drag item C to the beginning, observe target.childIndex = 0 which is expected
  3. Drag item C between A and B, observe target.childIndex = 2

Expected behavior I expect that in step 3 I get childIndex = 1. Could you confirm that above behavior is correct?

Screenshots

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version 22

Additional context My goal is too get new order position of the item. Right now I can't do this by using onDrop. If you could recommend how to better get new position order that would be great!

HannaHabr avatar Feb 21 '24 13:02 HannaHabr