vaadin / flow-components

Java counterpart of Vaadin Web Components
101 stars 66 forks source link

TreeGrid Drag'n'Drop getDraggedItems returns null item #3425

Open mheicke opened 2 years ago

mheicke commented 2 years ago

Description

We have a TreeGrid with two hierarchy levels. If you Drag'n'Drop an item from the first level into the second one, afterwards it is not possible to drag that item anymore, since whenever you try to drag it, the method GridDragStartEvent.getDraggedItems() returns a List only containing null.

Our Drag'n'Drop logic makes use of

Somehow after doing this, whenever you start a DragEvent on the item X you just dropped one level below, inside of the GridDragStartEvent the result for T item = source.getDataCommunicator().getKeyMapper().get(itemKey); will return null (also the keyObjectMap of the keyMapper does not contain the dragged item X)

Re-ordering other elements somehow seems to fix the key mapper and will allow to drag the item X again.

It seems to me like this problem has been introduced after Vaadin 23.0.8 since everything worked well there.

Expected outcome

I would expect that the element can be normally dragged after dropping it

Minimal reproducible example

Feel free to ping me on my email matthias.heicke@sweap.io so I can give you access to our repository (we already have an NDA with Vaadin)

Steps to reproduce

Environment

Vaadin version(s): 23.1.2 OS: MacOS

Browsers

Chrome, Safari

yuriy-fix commented 2 years ago

Could be affected by this: https://github.com/vaadin/flow-components/pull/3124

apklein commented 1 year ago

vaadin 24.0.5

for me only happends when i have only 1 child and I try to drag the child onto his parent.

but doesn't happends when i have more than 1 child and drag the child onto his parent.