[Repo Assist] feat(canvas): F11 borderless fullscreen toggle for Canvas windows#738
Conversation
Add F11/Escape keyboard shortcut to toggle borderless fullscreen in both Canvas window types (WebView2-based CanvasWindow and native A2UICanvasWindow). Implementation: - Use AppWindow.SetPresenter(AppWindowPresenterKind.FullScreen) to enter/exit fullscreen (WinUI 3 AppWindow API via Microsoft.UI.Windowing) - A2UICanvasWindow: KeyboardAccelerators on RootGrid (XAML tree handles F11/Esc natively) - CanvasWindow: KeyboardAccelerators on content root for XAML-focused state, plus JavaScript injection via AddScriptToExecuteOnDocumentCreatedAsync so F11/Escape are also captured when WebView2 content has focus and routed via the existing web bridge (postMessage) - Bridge messages 'fullscreen-toggle' and 'fullscreen-exit' are intercepted before forwarding to external BridgeMessageReceived subscribers - ExitFullScreen() called on window close to restore normal presenter state Closes #669 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: needs changes before merge. Reviewed June 10, 2026, 10:06 AM ET / 14:06 UTC. Summary Reproducibility: yes. for the introduced PR defect: focus WebView2 and press F11 or Escape; source inspection shows the injected code sends a string root to the existing object parser. The linked fullscreen request itself is a feature, not a bug reproduction. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Keep the AppWindow presenter design, send bridge objects directly from JavaScript, add focused regression coverage for both internal messages, and prove both Canvas implementations on Windows before merge. Do we have a high-confidence way to reproduce the issue? Yes for the introduced PR defect: focus WebView2 and press F11 or Escape; source inspection shows the injected code sends a string root to the existing object parser. The linked fullscreen request itself is a feature, not a bug reproduction. Is this the best way to solve the issue? No, not as written; AppWindow presenters are the appropriate window-level mechanism, but the WebView bridge must send objects directly and receive Windows runtime validation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: reasoning high; reviewed against 0e61fa287afb. Label changesLabel changes:
Label justifications:
Evidence reviewedAcceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
🤖 This is an automated pull request from Repo Assist.
Closes #669
Summary
Adds F11/Escape keyboard shortcut to toggle borderless fullscreen in both Canvas window types:
CanvasWindow— WebView2-based canvasA2UICanvasWindow— native XAML A2UI canvasRoot Cause
Neither Canvas window implemented a fullscreen presenter. The WinUI 3
AppWindowAPI (Microsoft.UI.Windowing) providesSetPresenter(AppWindowPresenterKind.FullScreen)/SetPresenter(AppWindowPresenterKind.Default)which handles fullscreen cleanly without manual Win32 ShowWindow tricks.Fix Rationale
A2UICanvasWindowKeyboardAcceleratorsregistered onRootGridhandle F11/Escape directly from the XAML tree. This is the standard WinUI pattern (same asChatWindow).CanvasWindow(WebView2)Two-layer approach required because WebView2 captures keyboard input at Win32 level when focused, bypassing XAML accelerators:
KeyboardAcceleratorson the root content element — handles F11/Escape when the title bar or any XAML element has focus.AddScriptToExecuteOnDocumentCreatedAsync— a content script listens forkeydownondocument(capture phase) and posts bridge messages (fullscreen-toggle,fullscreen-exit) when WebView2 has focus. These are intercepted in the existingWebMessageReceivedhandler before forwarding toBridgeMessageReceivedsubscribers, so web content is unaffected.Shared logic
Both windows use
AppWindow.SetPresenter()(inherited fromWindowEx→Window),_isFullScreenguard flag, andExitFullScreen()called in theClosedhandler with try/catch to handle window-destruction timing.Trade-offs
CanvasWindowis a clean established pattern for bridging native keyboard shortcuts into WebView2 content.fullscreen-toggle/fullscreen-exitbridge types are handled internally and never reachBridgeMessageReceivedsubscribers — intentional so existing consumers see no new message types.Microsoft.UI.Windowingis already part ofMicrosoft.WindowsAppSDK.Test Status
Tray tests:
Passed! - Failed: 0, Passed: 990, Skipped: 2, Total: 992✅Shared tests: 8 pre-existing failures in
MxcConfigBuilderTestsfor Windows drive-root path checks running on Linux (C:\vs/) — unrelated to this change. ✅Build validates cleanly with
GITHUB_ENV=/tmp/gh-aw/agent/github_env dotnet test /p:EnableWindowsTargeting=true.Note: The full
build.ps1(PowerShell + GitVersion) cannot run in the Linux agent environment, as GitVersion requires the GitHub Actions runner file-command paths. All compilation and unit tests pass.Add this agentic workflows to your repo
To install this agentic workflow, run