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
fix: make BrowserWindow#isFocused()
return false
when blur()
is called on macOS
#33734
fix: make BrowserWindow#isFocused()
return false
when blur()
is called on macOS
#33734
Conversation
a972eaf
to
c9e32e0
Compare
@RaisinTen, looks like the fixed test fails on Windows CI:
So this may be broken on Windows as well and the faulty test was hiding it. |
c9e32e0
to
b5ab85e
Compare
@dsanders11 thanks for noticing, updated the test to skip on Windows for now and added a reference to the open issue #20464. |
BrowserWindow#isFocused()
return false
when blur()
is calledBrowserWindow#isFocused()
return false
when blur()
is called on macOS
5dd5164
to
0b1bc02
Compare
2dd48a1
to
4d510ba
Compare
Why is the |
4d510ba
to
1de51f5
Compare
There was at least one passing macOS CI run for this change - https://app.circleci.com/pipelines/github/electron/electron/51968/workflows/8c551ade-118b-4fc7-9eff-fc55574bddff and the current failure is unrelated to this change. I think rerunning the macOS builds a couple of times will fix it. Could someone please do that (I don't have the permissions)? Also, this is ready for review. :) |
d9f60ff
to
6294a79
Compare
@zcbenz done! |
So it seems that the test only fails on forked PRs #34020, latest main branch has just disabled the test, rebasing this branch again should have the CI passing. |
…d on macOS The isFocused() method on macOS works by checking if the selected BrowserWindow is a key window. Unfortunately, this didn't work well with blur() because it wasn't calling any macOS APIs that would change the key status of the window. Hence, this changes the implementation of blur() to call orderOut first, which removes the key status of the window. Then when the orderBack function is called, it moves the window to the back of its level in the screen list, without changing the key window. Fixes: electron#33732 Signed-off-by: Darshan Sen <raisinten@gmail.com>
6294a79
to
42b1876
Compare
@zcbenz rebased, PTAL! |
Release Notes Persisted
|
I have automatically backported this PR to "17-x-y", please check out #34029 |
I have automatically backported this PR to "18-x-y", please check out #34030 |
I have automatically backported this PR to "19-x-y", please check out #34031 |
…d on macOS (electron#33734) The isFocused() method on macOS works by checking if the selected BrowserWindow is a key window. Unfortunately, this didn't work well with blur() because it wasn't calling any macOS APIs that would change the key status of the window. Hence, this changes the implementation of blur() to call orderOut first, which removes the key status of the window. Then when the orderBack function is called, it moves the window to the back of its level in the screen list, without changing the key window. Fixes: electron#33732 Signed-off-by: Darshan Sen <raisinten@gmail.com>
Description of Change
The
isFocused()
method on macOS works by checking if the selectedBrowserWindow
is a key window. Unfortunately, this didn't work wellwith
blur()
because it wasn't calling any macOS APIs that would changethe key status of the window. Hence, this changes the implementation of
blur()
to callorderOut
first, which removes the keystatus of the window. Then when the
orderBack
function is called, itmoves the window to the back of its level in the screen list, without
changing the key window.
Fixes: #33732
Signed-off-by: Darshan Sen raisinten@gmail.com
Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where
BrowserWindow#isFocused()
was returningfalse
whenblur()
was called on macOS.