Modification of Click-Through Behavior in Main Window Content Area

Commit: e49235e0 | 2025-09-18 18:16:36+00:00

← Back to List

Modification of Click-Through Behavior in Main Window Content Area

Moderate
Commit Hash: e49235e02ceb0737df2aa19ef0fa1069cd0810cd
Commit Time: 2025-09-18 18:16:36+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission modifies the implementation of the acceptsFirstMouse: method in RenderWidgetHostViewCocoa on macOS. The previous simple conditional logic has been replaced with a more detailed switch statement, providing different click handling strategies for various AcceptMouseEvents options. The main changes include: when acceptsMouseEventsOption is kWhenInActiveWindow, it now accepts the first click for either the mainWindow or keyWindow; for the kWhenInActiveApp and kAlways options, it directly returns YES. This change is primarily intended to resolve the issue where, when the find bar is active, the content area requires two clicks to pass the event to the page.

🎯 Impact Analysis

This change directly affects the handling behavior of mouse click events in WebView2Mac. The specific impacts include: 1) When the WebView2Mac window is the main window or key window, the first click will be directly accepted and passed to the web content, altering the original double-click activation behavior; 2) This may affect the interaction patterns of the user interface in WebView2Mac applications, especially the behavior when secondary UI elements (such as the find bar) become the key window; 3) For WebView2Mac instances using the default AcceptMouseEvents::kWhenInActiveWindow option, the user experience will change, and it will no longer be necessary to activate the window before interacting with the content; 4) If there are downstream custom implementations of acceptsMouseEventsOption in WebView2Mac, their behavior will also change accordingly. This change improves the directness of user interaction, but may also break application logic that relies on the original double-click activation mode.

Impacted Classes:

RenderWidgetHostViewCocoa RenderWidgetHostViewMacDelegate AcceptMouseEvents