feat: drag-and-drop files & images into WhatsApp Web (v0.4.0)#6
Merged
Conversation
Account windows are built with Tauri's default OS-level drag-and-drop handler enabled, so wry swallows native file drops (forwarding them as tauri://drag-drop events) before WhatsApp Web's HTML5 drop zone can see them — dropping a file or image did nothing. We don't use Tauri-side drag-drop events, so disable that handler and let the webview hand drops straight to web.whatsapp.com. On WebView2 (Windows) this is what makes HTML5 drag-and-drop work at all. Also guard against a webkit2gtk bug (tauri#9725, #12052) where a dropped file can make the webview navigate to its file:// URL and tear down the live session: cancel any file:// navigation via on_navigation. WhatsApp Web never legitimately loads file:// URLs. Release v0.4.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds drag-and-drop of files and images into the WhatsApp Web window. Drop a photo, video, or document straight onto a chat to attach it — previously dropping a file did nothing.
Why it didn't work
Account windows are built with Tauri v2's default OS-level drag-and-drop handler enabled. wry then swallows the native file drop (forwarding it as a
tauri://drag-dropevent) before WhatsApp Web's HTML5 drop zone can receive it. On WebView2 (Windows) wry additionally callsSetAllowExternalDrop(false)+ registers a customIDropTarget, fully blocking HTML5 DnD in the page.Fix (
src-tauri/src/window.rs).disable_drag_drop_handler()on the accountWebviewWindowBuilder— we don't use Tauri-side drag-drop events, so this hands drops straight toweb.whatsapp.com. This is the documented requirement for HTML5 DnD on Windows, and also restores it on Linux (webkit2gtk) and macOS (WKWebView)..on_navigation(|url| url.scheme() != "file")— guards against a known webkit2gtk bug (tauri#9725, #12052) where a dropped file can make the webview navigate to itsfile://URL and tear down the live session. WhatsApp Web never legitimately loadsfile://URLs.Verification
cargo build --locked✅ (Linux; CI covers Windows + macOS)cargo test --locked→ 48/48 pass ✅tauri 2.11/wry 0.55source (the versions in the tree)End-to-end drop-to-attach should be confirmed manually on a logged-in session.
Releases as v0.4.0.
🤖 Generated with Claude Code