@atlaskit/tree: Please expose onDragUpdate (updated)

Hi team,

It would be great if we could get access to and useful data from onDragUpdate, and would also allow preventing/customizing the expansion behavior.

The use case would be to provide more nuanced visual feedback to users during drag of items over items e.g. is it or is it not possible to drop or nest here? Additionally, this would enhance logic potential for isDragEnabled, isNestingEnabled, etc.

Currently, I believe it’s only possible to provide this feedback onDragEnd, which could be confusing UX i.e. “This space expanded, but I can’t drag and drop to this destination?” —sees onDragEnd feedback e.g. toast— “Oh, I can’t drag and drop here. I need to remember these conditions.”

Hopefully I’m not missing anything. :slight_smile:


edit 20210305:

In RenderItemParams, you access DraggableStateSnapshot i.e. snapshot.draggingOver and snapshot.combineWith. Use combineWith to determine if a drop is possible when dragging over a TreeItem and adjust render item styles.

However, this only works well when dragging over an item — not when dragging above or under i.e. combineWith is null. It’s likely possible to get the desired effect during this condition by tracking state of combineWith i.e. is draggingOver not null but combineWith now is?

Still testing. :stuck_out_tongue_winking_eye:

More info on DraggableStateSnapshot: https://egghead.io/lessons/react-customise-the-appearance-of-an-app-during-a-drag-using-react-beautiful-dnd-snapshot-values

Thanks for posting the request! I’ll pass it along to the team that maintains the @atlaskit/tree component.

To be sure we’re on the same page about the request - are you suggesting to expose the onDragUpdate as-is from the react-beautiful-dnd, which is used under the hood in the @atlaskit/tree?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.