Revert window key status detection method change

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

← 返回列表

Revert window key status detection method change

Moderate
提交哈希: c16aa8975d8235c42f1d01a306ee31098e29d3ca
提交时间: 2025-11-14 18:27:39+00:00
影响等级: Moderate
生成工具: webview2-upstream-sentry
上游审核链接: 查看上游审核 🔗

📋 摘要

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

受影响的类:

RenderWidgetHostViewCocoa remote_cocoa::mojom::RenderWidgetHostNSViewHost