Skip to content
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

win.blur() returns focus to the previous window on the OS level, but this does not occur if the previously focused window was a sibling window. #21963

Closed
3 tasks done
Nantris opened this issue Jan 30, 2020 · 14 comments

Comments

@Nantris
Copy link
Contributor

Nantris commented Jan 30, 2020

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version: 7.1.10
  • Operating System: Windows 7 & Windows 10 (Build 1803) (Confirmed working macOS 10.13.6 / Mint 19)
  • Last Known Working Electron version: Unknown, but I think this has never worked on Windows after encountering several related issues (see below) and examining my code - I had implemented a workaround for this since at least Electron@3.

Expected Behavior

Calling win.blur() will return focus to the previously focused window

Actual Behavior

If the previously focused window is part of the same Electron application, upon win.blur() the user will have no window focused.

To Reproduce

  1. Create two BrowserWindows (allow remote module for simplicity)
  • WinA can be empty
  • In WinB include <button onclick="remote.getCurrentWindow().blur()>Blur</button>
  1. Focus WinA
  2. Click Blur in WinB

Press some OS level hotkey to affect the window, either closing, minimizing, etc - it will fail. Of course webContents is also not focused, but for simplicity's sake.

Additional Information

Seems very likely related to #20464 and #19977

@dpilarsk
Copy link

Did you test on macOS ? Because I seem to have the same problem on Electron 7.1.10 too

@Nantris
Copy link
Contributor Author

Nantris commented Apr 15, 2020

I did test macOS and Linux with that version of Electron and had no issues. What version of macOS?

@dpilarsk
Copy link

dpilarsk commented Apr 15, 2020 via email

@Nantris
Copy link
Contributor Author

Nantris commented Apr 15, 2020

Interesting. Please do mention the exact version if you can (as per the issue template, which I know you can't see just leaving a comment - in my case 10.13.6)

In any event, it doesn't look like this issue is going to get any attention.

@electron-triage
Copy link

The Electron version reported on this issue is no longer supported. See our supported versions documentation.

If this is still reproducible on a supported version, please open a new issue with any other new information that a maintainer should know.

Thank you for taking the time to report this issue and helping to make Electron better! Your help is appreciated.

@Nantris
Copy link
Contributor Author

Nantris commented Mar 9, 2021

Still an issue in 11.3.0.

@nornagon nornagon reopened this Mar 12, 2021
@Nantris
Copy link
Contributor Author

Nantris commented May 17, 2021

Still an issue in 11.4.7.


Also window.blur() in development now focuses the Windows taskbar rather than any previously focused window. This is equivalent to clicking an empty area in the taskbar. In both situations Tab will cycle through taskbar controls. I don't think this used to happen, but perhaps that's my imagination.

@Profnird
Copy link

To make easy me I did make use of node-notifier to take care of my alerts and notifications. Using alert seems to bring problems at data entry points!. So I will advise for now one should make use of a third-party notifier like (node-notifier) which makes use of the native windows notification system at least thats a lot nicer. you just have to send your notification msg to the ipc main from your ipc renderer then boom there you go !!

@Nantris
Copy link
Contributor Author

Nantris commented Dec 11, 2021

Still an issue on Windows in 13.6.0. Works fine on Linux.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2022

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 8, 2022
@Nantris
Copy link
Contributor Author

Nantris commented Oct 9, 2022

Not fixed to my knowledge, but I don't have an updated repro available right now.

@github-actions github-actions bot removed the stale label Oct 10, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Jan 10, 2023
@github-actions
Copy link
Contributor

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2023
@Nantris
Copy link
Contributor Author

Nantris commented Feb 11, 2023

I don't believe this is fixed but I don't have a repro. I somehow missed the stale notification. This seems possibly related to #19977.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
7.2.x
Unsorted Issues
Development

No branches or pull requests

6 participants