Skip to content

fix drag and drop#6553

Merged
artf merged 1 commit intodevfrom
fix-sorter-drop-area
Jun 27, 2025
Merged

fix drag and drop#6553
artf merged 1 commit intodevfrom
fix-sorter-drop-area

Conversation

@mohamedsalem401
Copy link
Contributor

This PR fixes an issue where components dragged from an undroppable region into a droppable one were not being recognized. The fix implements a check that detects the transition based on the last mouse event, allowing the sorter to correctly handle these movements.

Comment on lines -282 to -292
/**
* Checks if the target node has changed and returns the last one if they are identical.
*
* @param targetNode - The newly calculated target node.
* @returns The new or reused target node.
*/
private getOrReuseTargetNode(targetNode?: NodeType): NodeType | undefined {
const lastTargetNode = this.lastMoveData.targetNode;
return targetNode?.equals(lastTargetNode) ? lastTargetNode : targetNode;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has nothing to do with the PR, just cleanup

const sameHoverPosition =
sameHoveredNode &&
sameHoveredIndex &&
isWithinDropArea === targetNode.isWithinDropBounds(lastMouseEvent?.clientX ?? 0, lastMouseEvent?.clientY ?? 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, if last movement was over an undraggable area but now it's on draggable area, don't use the cached values

Copy link
Member

@artf artf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💜

@artf artf merged commit d2d87df into dev Jun 27, 2025
3 checks passed
@mohamedsalem401 mohamedsalem401 deleted the fix-sorter-drop-area branch July 1, 2025 00:35
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

Successfully merging this pull request may close these issues.

2 participants