Support file-manager drops in macOS webviews - #11
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8821344. Configure here.
|
|
||
| override func prepareForDragOperation(_ sender: NSDraggingInfo) -> Bool { | ||
| super.prepareForDragOperation(sender) || acceptsFileDrop(sender) | ||
| } |
There was a problem hiding this comment.
Rejected file drops are force-accepted
Medium Severity
FileDropWebView returns .copy and prepares the drop when the pasteboard has file types and WebKit reports no operation. performDragOperation then only forwards to WebKit. That accepts drops the page already refused, so WebKit may load the file:// URL instead of firing a page drop with dataTransfer.files. File-promise drags can also show a copy cursor and still deliver an empty FileList.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8821344. Configure here.
Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>


Summary
FileDropWebViewfor Finder file URLs and file promises.dropanddataTransfer.files.window.openandwebview.rebuild.Checks
./scripts/build_macos.shMIX_ENV=test NO_WX=1 mix test.unitMIX_ENV=test NO_WX=1 mix test.e2emix format --check-formattedAll automated checks pass. Native picker and Finder, Explorer, and Linux file-manager drag checks need an interactive desktop.
Note
Low Risk
macOS-only native change is limited to drag registration and forwarding around WKWebView; protocol/docs updates are additive with no auth or RPC behavior changes.
Overview
Adds Finder file-manager drag-and-drop on macOS by introducing
FileDropWebView, aWKWebViewsubclass that registers file URL and file-promise pasteboard types, accepts Finder drags when WebKit would not, and delegates drop handling to WebKit so pages get normaldropevents withdataTransfer.files.WebWindownow createsFileDropWebViewon initial window setup and onwebview.rebuild.Documentation treats file-manager drag-and-drop as a required host feature on macOS, Windows, and Linux (alongside HTML file inputs), with a new normative section in
docs/protocol.md, updated porting hooks, status matrix rows, and platform READMEs. Windows/Linux behavior is specified as preserving engine drag handling—no native code changes in this PR beyond macOS.Reviewed by Cursor Bugbot for commit 8821344. Configure here.