feat(v3): add mac.DisableEscapeExitsFullscreen opt-in for fullscreen Esc#5307
Conversation
Add DisableEscapeExitsFullscreen bool to MacWindow options so apps can opt in to preventing the Escape key from exiting fullscreen mode, allowing web content (e.g. modals with Esc-to-close behaviour) to handle Esc without triggering the macOS system behaviour that exits the fullscreen window. The flag is stored as a BOOL property on WebviewWindow (the custom NSWindow subclass) and checked in a cancelOperation: override: when the window is fullscreen and the flag is true, the Esc keypress is swallowed; otherwise the default macOS behaviour is preserved via [super cancelOperation:sender]. Default false, so all existing apps are unaffected. Ports v2 PR #5242 to v3.
|
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 (4)
WalkthroughThis PR adds the ChangesDisable Escape Exits Fullscreen (macOS)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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.11.4)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. Review rate limit: 6/8 reviews remaining, refill in 12 minutes and 27 seconds.Comment |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in macOS window option in v3 to prevent the Escape key from exiting fullscreen, allowing web content (e.g., modals/custom handlers) to consume Esc while fullscreen, while preserving default macOS behavior for existing apps.
Changes:
- Added
MacWindow.DisableEscapeExitsFullscreenoption to v3 window options. - Added a
disableEscapeExitsFullscreenproperty to theWebviewWindow(NSWindow subclass) on macOS. - Implemented a
cancelOperation:override (and Go↔ObjC bridge) to swallow Esc only when fullscreen and the option is enabled.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| v3/pkg/application/webview_window_options.go | Exposes the new macOS option on MacWindow. |
| v3/pkg/application/webview_window_darwin.h | Adds the ObjC WebviewWindow BOOL property backing the behavior. |
| v3/pkg/application/webview_window_darwin.m | Implements cancelOperation: to conditionally swallow Esc while fullscreen. |
| v3/pkg/application/webview_window_darwin.go | Adds cgo bridge setter and wires the option into window creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… mac.DisableEscapeExitsFullscreen opt-in for fullscreen Esc
Summary
Ports
DisableEscapeExitsFullscreenfrom v2 (PR #5242) to v3.When
Mac.DisableEscapeExitsFullscreen: true, the Escape key is swallowed while the window is fullscreen, allowing web content (modals, custom Esc handlers) to consume it. Defaultfalsepreserves standard macOS behaviour (Esc exits fullscreen) for all existing apps.Implementation
cancelOperation:override onWebviewWindowchecks both the flag andNSWindowStyleMaskFullScreenbefore deciding whether to call[super cancelOperation:sender]:Files changed (4, +22/-0)
v3/pkg/application/webview_window_options.goDisableEscapeExitsFullscreen booltoMacWindowstructv3/pkg/application/webview_window_darwin.h@property BOOL disableEscapeExitsFullscreentoWebviewWindowv3/pkg/application/webview_window_darwin.mcancelOperation:overridev3/pkg/application/webview_window_darwin.gowindowSetDisableEscapeExitsFullscreen(); called at window creation when flag is trueUsage
Notes
false— zero breaking change for existing apps.eaf56c932) already reviewed and merged via PR fix(v2): Prevent Esc from exiting fullscreen on macOS #5242.go build ./v3/pkg/application— clean, no errors or warnings.Ports v2 PR #5242.
Summary by CodeRabbit