Skip to content

fix(dnd): prevent repeated useDrop enter/exit events for portal children#9844

Open
reidbarber wants to merge 1 commit intomainfrom
dnd-portal-fix
Open

fix(dnd): prevent repeated useDrop enter/exit events for portal children#9844
reidbarber wants to merge 1 commit intomainfrom
dnd-portal-fix

Conversation

@reidbarber
Copy link
Member

Closes #9825

Previously, we were removing tracked elements on every bubbled child dragleave, and portal children bubble through React’s tree even though they are not DOM descendants of the drop target. Now we only remove non-contained elements when the drag is leaving the drop target itself.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Unit test should cover.

🧢 Your Project:

@rspbot
Copy link

rspbot commented Mar 25, 2026

@reidbarber
Copy link
Member Author

Also, I noticed this Webkit issue just got resolved: https://bugs.webkit.org/show_bug.cgi?id=66547

So maybe eventually we can just use e.relatedTarget.

@reidbarber reidbarber enabled auto-merge March 26, 2026 01:21
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.

useDrop: unexpected onDropEnter/onDropExit when dragging over portal content inside a drop target

3 participants