[WIP] fix: avoid blurring window when using Character Viewer pop-up on macOS#19128
[WIP] fix: avoid blurring window when using Character Viewer pop-up on macOS#19128erickzhao wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
I think the root problem of #19124 and #18502 is rwhv->SetActive getting called when it shouldn't.
After checking the call stack of RenderWidgetHost::SetActive I found it is already being called inside content module, and it is not being called by other parts of Chrome, so removing the rwhv->SetActive calls in BrowserWindow should be enough to fix the issues.
(The rwhv->SetActive calls were inherited from ancient Chrome code.)
And we should also check whether removing rwhv->SetActive alone would be able to fix #18502, and if it is, we should also revert #18995 as focus/blur should map to the main window events instead of key window events.
|
It seems like removing the However, both solutions give less than desirable outcomes for firing With the
I'm not particularly sure what to do in this case. It seems like removing the |
a34c7d7 to
6bc0e08
Compare
|
I think we got confused with 2 types of For For DOM Window, the focus events, which are controlled by So to correctly fix both issues without breaking focus events of
We would need to add more methods to |
|
@zcbenz @codebytere @nornagon do you think that we should first move to revert the original change? PR #18995 was backported to 6, 5, and 4, and it seems like this issue is more immediately pressing for macOS users than the modal focus behavior. |
|
Reverting #18995 first sounds good to me. |
|
Going to close this and attempt to resolve #18502 in a future PR as per the comments above. |
Description of Change
Context
In PR #18995, I had submitted a fix such that
focusandblurevents were listening for changes in the Key window rather than the Main window.However, Issue #19124 showed that since a window would lose its Key status when the macOS Character Viewer was activated, the
blurevent would make any input on the window lose its focus.Then, the character selected from the Character Viewer wouldn't be entered into the input.
Change
I did not find much documentation regarding the behavior of
NSWindowwith respect to the Character Viewer. After playing around withwindowDidResignKey, I found that when the Character Viewer appears, the window loses its Key status, but the[NSApp keyWindow]variable still referenced the original window.Thus, I added a conditional check to only apply the
blurevent if the resigning window and the new key window weren't the same.cc @codebytere @zcbenz @javan
Checklist
npm testpassesRelease Notes
Notes: Fixed bug on macOS that broke input from the Character Viewer popup.