Fix tab bar height and right-click issues in macOS 26 full screen mode
Moderate
Commit Hash:
a679ed946e3b96a7c72fb75fcc8e5d9762badb7f
Commit Time: 2025-08-12 21:03:46+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This commit fixes two issues in macOS 26 full-screen mode: 1) The tab bar area was too tall, resulting in a horizontal white gap. This is resolved by ensuring the main window’s toolbar style is UnifiedCompact, allowing AppKit to respect the fullScreenMinHeight of the title bar accessory; 2) The context menu could not be triggered by right-clicking the tab bar. This is addressed by swizzling the private method _hitTestForEvent: of NSToolbarView to resolve the issue where NSToolbarView intercepts right mouse events. Added swizzle_ns_toolbar_view_hit_test.h/.mm files, and invoked related functions in immersive_mode_tabbed_controller_cocoa.mm.
🎯 Impact Analysis
This change has potentially significant impact on WebView2Mac. Although the modification mainly targets the browser’s fullscreen mode and tab bar management, it involves core components of Remote Cocoa, especially the ImmersiveModeTabbedControllerCocoa class, which may be the window management mechanism that WebView2Mac relies on. The newly added NSToolbarView swizzling mechanism may affect event handling in WebView2Mac, particularly the routing of right-click events. If WebView2Mac uses similar toolbar or title bar accessory features in fullscreen mode, it may be affected by these changes. In addition, method swizzling is a runtime modification that may have a global impact on event handling throughout the application, so it is necessary to ensure that WebView2Mac’s event handling mechanism is compatible with these changes.
Impacted Classes:
ImmersiveModeTabbedControllerCocoa
NSToolbarView
remote_cocoa::SwizzleNSToolbarViewHitTest