-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[v2] Fix Windows HTML drag and drop (#3782) #4646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
* Move AllowExternalDrag call after chromium.Embed() * Add capability check before calling AllowExternalDrag * Change condition from DisableWebViewDrop to EnableFileDrop * Update changelog Fixes #3782 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
WalkthroughSwitches Windows drag-and-drop handling to an opt-in flow: removes unconditional/disable path and adds a new EnableFileDrop check after Chromium embed, gated by an AllowExternalDrop capability. Updates changelog to note the Windows HTML drag-and-drop fix and the new call order/capability gating. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App
participant WinFrontend as Windows Frontend
participant Chromium as Chromium Edge
App->>WinFrontend: Start (with DragAndDrop config)
WinFrontend->>Chromium: Embed()
Note over WinFrontend,Chromium: Post-embed initialization
alt DragAndDrop.EnableFileDrop is true
WinFrontend->>Chromium: Check capability: AllowExternalDrop?
alt Capability available
WinFrontend->>Chromium: AllowExternalDrag(false)
Note right of Chromium: External HTML DnD disabled<br/>OS-level file drop enabled
else Capability missing
WinFrontend->>WinFrontend: Log warning (capability unavailable)
end
else EnableFileDrop is false
Note over WinFrontend: No change to external drag behavior
end
WinFrontend->>WinFrontend: Initialize swipe navigation handlers
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
v2/internal/frontend/desktop/windows/frontend.go (1)
545-552: Correct placement and gating; include error details in warning.Logic matches v3: after Embed, gated by EnableFileDrop and capability. Improve diagnosability by logging the underlying error.
- if err != nil { - f.logger.Warning("WebView failed to set AllowExternalDrag to false!") - } + if err != nil { + f.logger.Warning("WebView2 AllowExternalDrag(false) failed: %v", err) + }website/src/pages/changelog.mdx (1)
30-30: Clarify that the change is gated by EnableFileDrop.Add the EnableFileDrop gating note to match the implementation and v3 behavior.
- - Fixed Windows HTML drag and drop by moving AllowExternalDrag call after Embed and adding capability check [#3782](https://github.com/wailsapp/wails/issues/3782) + - Fixed Windows HTML drag and drop by moving AllowExternalDrag call after Embed, gating it behind `EnableFileDrop`, and adding a capability check [#3782](https://github.com/wailsapp/wails/issues/3782)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
v2/internal/frontend/desktop/windows/frontend.go(1 hunks)website/src/pages/changelog.mdx(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
v2/internal/frontend/desktop/windows/frontend.go (1)
v2/pkg/options/options.go (1)
DragAndDrop(201-216)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: semgrep-cloud-platform/scan



Summary
Fixes Windows HTML drag and drop functionality by properly configuring
AllowExternalDragafter WebView2 initialization.This is a backport of the v3 fix from PR #4259 to v2.
Changes
AllowExternalDrag(false)call to afterchromium.Embed()(was called before)chromium.HasCapability(edge.AllowExternalDrop)check before callingDisableWebViewDroptoEnableFileDrop(consistent with v3)Technical Details
The issue occurred because:
AllowExternalDragwas called before the WebView2 was embedded, causing it to fail silentlyWhen
EnableFileDropis true, Wails needs to handle dropped files, so we disable the webview's native external drag to prevent it from opening files automatically.Testing
Related
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation