New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] fix: avoid blurring window when using Character Viewer pop-up on macOS #19128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like Chrome's app shim does the same thing.
Please remove the commented-out debugging code before you merge :)
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
focus
andblur
events 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
blur
event 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
NSWindow
with 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
blur
event if the resigning window and the new key window weren't the same.cc @codebytere @zcbenz @javan
Checklist
npm test
passesRelease Notes
Notes: Fixed bug on macOS that broke input from the Character Viewer popup.