Repository navigation
fix(dnd): fix drag-and-drop to folders on Windows (WebView2) - #23
Merged
Merged
Conversation
WebView2 (Windows) can have dragId as null when dragover fires on a folder/trash/lanes target, preventing e.preventDefault() from being called and blocking the drop. Check e.dataTransfer.types instead, which is always available during dragover across all browsers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes drag-and-drop of tracks to library folders not working on the Windows desktop app.
Root cause: The
dragoverhandlers guardede.preventDefault()behindif (!dragId)— a module-level variable set indragstart. On WebView2 (Windows),dragIdcan benullwhendragoverfires on a different element, soe.preventDefault()was never called, causing the browser to reject the drop entirely.Fix: Replaced the
dragIdguard withisTrackDragEvent(e)which checkse.dataTransfer.types.includes(TRACK_DRAG_TYPE)— thetypesarray is always populated duringdragoveracross all browsers, including WebView2. The custom MIME type (application/x-stemdeck-track) is only ever set by our owndragstarthandler, so this guard remains exclusive to internal track drags.drophandlers are unchanged — they still validate the track ID and existence before acting.Test plan