Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop validation #123

Open
chasedeanda opened this issue May 7, 2020 · 1 comment
Open

Drag and drop validation #123

chasedeanda opened this issue May 7, 2020 · 1 comment

Comments

@chasedeanda
Copy link

Great work on this component it is very clean and user friendly! I need to write some validation for handling drag and drop events.

Is there a way to reject a drop that would put the dragged element back in its original place?

@jledentu
Copy link
Owner

jledentu commented May 9, 2020

Hi! Thank you! I appreciate your feedback.

No, the move event doesn't provide a way to cancel a drop that happened. But the canDrop prop allows to prevent the dragOver event on some items:

const canDrop = (targetId, draggedId) => {
   // Return false if the dragged item cannot be dropped on the target item
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants