Skip to content

fix(platform): clear the full-page drop overlay after a composer drop#2121

Merged
larryro merged 1 commit into
mainfrom
fix/page-drop-overlay-stuck-after-composer-drop
Jun 24, 2026
Merged

fix(platform): clear the full-page drop overlay after a composer drop#2121
larryro merged 1 commit into
mainfrom
fix/page-drop-overlay-stuck-after-composer-drop

Conversation

@larryro

@larryro larryro commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Dragging a file onto the chat composer left the full-page "Drop files here to upload" overlay stuck — covering the page and blocking all interaction until a manual reload. The file still attached (the composer handled the drop), but the overlay never dismissed.

Root cause

The full-page overlay is PageDropOverlay, driven by the window-level usePageFileDrop hook (chat-interface.tsx:480/1159). The chat composer's FileUpload.DropZone calls e.stopPropagation() on its drop (file-upload.tsx:187) so the file lands on the composer rather than the window handler. But stopPropagation() also prevents the window's bubble-phase drop listener from ever running — so isDragOver / dragDepth never reset, and the overlay sticks until reload. The hook's own design note even anticipated the "region zone wins" routing, but missed that the reset then never fires.

Fix

Reset the overlay state (dragDepth = 0; setIsDragOver(false)) in a capture-phase window drop listener. The capture phase runs window → target, before any child's stopPropagation(), so the reset always fires regardless of who handles the drop. The existing bubble-phase handler still owns the upload for drops that don't hit a region zone, so there's no double-upload.

window.addEventListener('drop', onDrop);                 // bubble: upload (non-region drops)
window.addEventListener('drop', onDropResetCapture, true); // capture: reset always

Testing

  • New regression test in use-page-file-drop.test.ts: drops onto a child element that stopPropagation()s and asserts (a) the overlay clears and (b) the window handler does not also upload. Fails without the fix, passes with it.
  • app/hooks/use-page-file-drop.test.ts — 5/5 pass · platform tsc 0 · lint 0

Notes

Dropping a file onto the chat composer left the full-page "Drop files here" overlay (PageDropOverlay / usePageFileDrop) stuck until a manual page reload. The composer's FileUpload.DropZone calls stopPropagation() on its drop so the file lands there — which also stopped the window's bubble-phase drop handler from running, so isDragOver/dragDepth never reset.

Reset the overlay state in the CAPTURE phase, which runs window->target BEFORE any child's stopPropagation, so it always fires. The bubble handler still owns the upload for drops that don't hit a region zone (no double-upload). Adds a regression test.
@larryro larryro merged commit ea29c49 into main Jun 24, 2026
67 of 68 checks passed
@larryro larryro deleted the fix/page-drop-overlay-stuck-after-composer-drop branch June 24, 2026 15:09
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.

1 participant