Revert window key status detection method change

Commit: c16aa897 | 2025-11-14 18:27:39+00:00

← Back to List

Revert window key status detection method change

Moderate
Commit Hash: c16aa8975d8235c42f1d01a306ee31098e29d3ca
Commit Time: 2025-11-14 18:27:39+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review πŸ”—

πŸ“‹ Summary

This commit reverts a change that modified the window focus status detection logic. The original change replaced the condition check in the windowDidResignKey: method from [NSApp keyWindow] == [self window] to [self window].isKeyWindow, aiming to fix timing issues in focus state detection when clicking notifications in multi-window scenarios. However, this modification broke menu functionality.

3. **JavaScript API Impact**: The focus detection logic directly affects the return value of JavaScript's document.hasFocus() API. If focus state detection is inaccurate, web content embedded in WebView2Mac may incorrectly determine focus state.

4. ** menu issue, WebView2Mac needs to ensure that dropdown menus in embedded web content work correctly.

Recommendations for the WebView2Mac team:
- Test focus switching behavior in multi-window scenarios
- Verify normal functionality of menus

Impacted Classes:

RenderWidgetHostViewCocoa remote_cocoa::mojom::RenderWidgetHostNSViewHost