Skip to content

Conversation

@TheFireBlast
Copy link
Contributor

Sometimes, the dragenter event fires before the dragleave event, causing the drop target container and element information to be lost. While the exact cause isn't clear, this issue occurs fairly frequently when items are positioned very close to each other (e.g., with zero margin), at least on Firefox.

This pull request simply adds a check to ensure the drop target is only set to null if it hasn’t already been replaced by another item.

@Spikeysanju Spikeysanju self-assigned this Jan 23, 2025
@Spikeysanju
Copy link
Contributor

This pull request includes changes to the droppable function in the src/lib/actions/droppable.ts file to improve the handling of drag-and-drop events. The most important changes include adding conditions to reset the targetContainer and targetElement properties in specific scenarios.

Improvements to drag-and-drop handling:

  • src/lib/actions/droppable.ts: Added a condition to reset targetContainer and targetElement when the target container and element match the current event target during the onDragLeave callback.
  • src/lib/actions/droppable.ts: Added a condition to reset targetContainer when the target container matches the current options container during the handlePointerOut event.

@Spikeysanju Spikeysanju added the bug Something isn't working label Jan 23, 2025
@Spikeysanju Spikeysanju merged commit acfab09 into thisuxhq:main Jan 23, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants