feat(mac/v3): extend MacWebviewPreferences with additional WKWebView config options#5549
Conversation
Adds v3 parity for the options introduced/planned for v2: - EnableAutoplayWithoutUserAction → mediaTypesRequiringUserActionForPlayback - AllowsAirPlayForMediaPlayback → config.allowsAirPlayForMediaPlayback - AllowsMagnification → webView.allowsMagnification - JavaScriptCanOpenWindowsAutomatically → config.preferences.javaScriptCanOpenWindowsAutomatically - MinimumFontSize → config.preferences.minimumFontSize - ApplicationNameForUserAgent → config.applicationNameForUserAgent (overrides "wails.io" default)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds six macOS WKWebView preferences (magnification, AirPlay, JS auto-window opening, minimum font size, applicationNameForUserAgent, autoplay without user gesture), threads them through Go structs and cgo to a changed C windowNew signature, and applies them in the native WKWebViewConfiguration/WKWebView setup. Documentation updated. ChangesmacOS WebView Preferences
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" 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.
Pull request overview
This PR extends Wails v3 macOS MacWebviewPreferences to expose additional WKWebView / WKWebViewConfiguration settings, closing feature parity gaps (notably autoplay without user action) previously addressed in v2.
Changes:
- Added new
MacWebviewPreferencesfields for magnification, AirPlay, JS window-opening, minimum font size, user-agent application name, and autoplay without gesture. - Wired the new preferences through the macOS window creation path into
WKWebViewConfiguration/WKPreferences/WKWebView. - Updated the native
windowNewbridge to accept anapplicationNameForUserAgentparameter with a"wails.io"fallback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| v3/pkg/application/webview_window_options.go | Adds new macOS webview preference fields to the public options struct. |
| v3/pkg/application/webview_window_darwin.go | Threads new preferences through the cgo/ObjC bridge and applies them to WKWebViewConfiguration / WKWebView. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…cationNameForUserAgent
Bundles content from the failed alpha.99 release (tag pushed but no GitHub release created due to token misconfiguration) together with the alpha.100 cycle. Includes: - MacWebviewPreferences WKWebView extensions (#5549) - generate bindings "Access is denied" fix on Windows (#5561) - Linux frameless JS resize / scrollbar edge detection fix (#5368) - Windows updater cross-volume rename fallback (#5560)
Summary
Adds v3 parity for WKWebView configuration options, including the
EnableAutoplayWithoutUserActionfeature from #5512.New fields in
MacWebviewPreferences:EnableAutoplayWithoutUserActionconfig.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNoneAllowsAirPlayForMediaPlaybackconfig.allowsAirPlayForMediaPlaybackAllowsMagnificationwebView.allowsMagnificationJavaScriptCanOpenWindowsAutomaticallyconfig.preferences.javaScriptCanOpenWindowsAutomaticallyMinimumFontSizeconfig.preferences.minimumFontSizeApplicationNameForUserAgentconfig.applicationNameForUserAgent(falls back to"wails.io"if empty)Related
Closes the v3 gap for #5512.
Test plan
go build ./v3/pkg/application/EnableAutoplayWithoutUserAction: optional.TrueApplicationNameForUserAgentoverride appears in the webview's user agent stringSummary by CodeRabbit