Support HTML file inputs on desktop hosts - #10
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
WKUIDelegateopen-panel callback for HTML file inputsTesting
swift build -c debug./scripts/build_macos.shMIX_ENV=test NO_WX=1 mix test --exclude e2eMIX_ENV=test NO_WX=1 DESKTOP_WEBVIEW_BINARY=priv/native/macos/DesktopWebView mix test.e2eNative picker selection and cancellation remain manual checks because the shared E2E suite cannot drive OS file dialogs.
Note
Medium Risk
macOS modal sheet file panels run on the UI thread and touch web content file APIs; incorrect cancel/multiple/directory mapping could break uploads, though scope is isolated to the new delegate hook.
Overview
Adds required
<input type="file">support across macOS, Windows, and Linux, explicitly separated from thedialog.choose_fileElixir RPC.On macOS, implements
WKUIDelegate’s open-panel callback inWebWindow.swift, wiringNSOpenPanelfor single/multiple/directory picks andnilon cancel. Windows and Linux are documented to rely on WebView2’s built-in picker and WebKitGTK’s defaultrun-file-chooserhandler—no new native code in this PR for those platforms.Protocol and porting docs now define chooser semantics (multiple,
webkitdirectory, cancel behavior,accept). Platform status matrices mark HTML file input as partial until manual native picker checks land.E2E adds
test/fixtures/file_input.html, a sharedfixture_url/1helper (base64data:URLs), andHTML file input fixture exposes chooser semantics—DOM-only assertions viatest.webview.eval; actual picker interaction stays manual.Reviewed by Cursor Bugbot for commit 703c9aa. Configure here.