react-component / react-component/tree

Need if node drops inside same node, we still need the callback event

Open
#193 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
490
Avg merge
3d 17h
Merged PRs (30d)
5

Description

I am wondering if we can have a small change, in the case where we drop an element inside the same element, It would be better to have the onDrop function still executed because I cannot catch the event ( in Tree.js)
if (dragNodesKeys.indexOf(eventKey) !== -1) { warning(false, 'Can not drop to dragNode(include it\'s children node)'); return; }
would be perfect if it would be:
if (dragNodesKeys.indexOf(eventKey) !== -1) { warning(false, 'Can not drop to dragNode(include it\'s children node)'); if (onDrop) { onDrop(null); } return; }
What do you think ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Tree.js at the drop guard shown in the issue and trace how onDrop is currently handled for rejected drops. Confirm the desired behavior against the existing drop flow; done means dropping inside the same node still triggers onDrop without allowing the invalid drop.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.