Skip to content

Support file-manager drops in macOS webviews - #11

Merged
dominicletz merged 2 commits into
masterfrom
feat/html-file-drag-drop
Sep 4, 2026
Merged

Support file-manager drops in macOS webviews#11
dominicletz merged 2 commits into
masterfrom
feat/html-file-drag-drop

Conversation

@dominicletz

@dominicletz dominicletz commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add FileDropWebView for Finder file URLs and file promises.
  • Preserve WebKit drag handling so pages receive drop and dataTransfer.files.
  • Use the custom webview after window.open and webview.rebuild.
  • Make file-manager drag-and-drop a required feature for macOS, Windows, and Linux.
  • Document the platform hooks and manual checks.

Checks

  • ./scripts/build_macos.sh
  • MIX_ENV=test NO_WX=1 mix test.unit
  • MIX_ENV=test NO_WX=1 mix test.e2e
  • mix format --check-formatted

All 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, a WKWebView subclass 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 normal drop events with dataTransfer.files. WebWindow now creates FileDropWebView on initial window setup and on webview.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.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8821344. Configure here.

Co-authored-by: Dominic Letz <dominicletz@users.noreply.github.com>
@dominicletz
dominicletz merged commit 3ed9a44 into master Sep 4, 2026
4 checks passed
@dominicletz
dominicletz deleted the feat/html-file-drag-drop branch September 4, 2026 00:44
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.

2 participants