-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
nw2: blur
event does not trigger when removing focus from application window for the first time
#7982
Comments
When looking at this piece of code nw.js/src/resources/api_nw_newwin.js Lines 175 to 188 in a27b582
it looks like the initial focused state is undefined, hence why the blur callback is not firing for the first time. But that's just my quick conclusion after looking at the code for a few minutes.
Does the initial nw.js/src/resources/api_nw_newwin.js Lines 772 to 773 in a27b582
nw.js/src/resources/api_nw_window.js Lines 664 to 665 in a27b582
How can I make modifications to the internal NW.js JS code for debugging purposes without rebuilding the entire thing? Setting breakpoints in the dev tools window unfortunately interferes with the focus and blur events, so I can't use this and would like to write simple debugging messages to stdout instead in order to understand the code/event flow with the current state. |
Is there a chance for a quick bugfix for this? As said, this is only broken on NW2 and it doesn't seem too difficult to fix. If I knew how to make modifications to the internal NW.js JS modules without (re)building the entire thing, I could help debugging this. So far I haven't received any response here yet. @rogerwang This bug is breaking my application if I want to switch from NW1 to NW2, and on NW1 I'm currently facing the |
Still broken on 0.87.0. Tested on Linux, macOS and Windows. |
Issue Type
Current/Missing Behavior
Follow-up of issue #7488
When launching NW.js, the opened window is apparently not aware of its focused state, and when removing the focus of the application window for the first time, the
blur
event does not trigger. Upon focusing the application window again, thefocus
event triggers, as expected, and when removing the focus again, then theblur
event triggers for the first time.Manually calling
nwWindow.focus()
/nwWindow.blur()
or any combination of that after launching the application or showing the window does not help (re)setting the state.On the old nw1 implementation, the focus/blur events work as expected. This is only broken on nw2.
Related comment: #7981 (comment) (reason for my app having to use nw1)
Expected/Proposed Behavior
The application window state should be set correctly when opening and showing the window, so the
blur
event can trigger when the user removes focus from the application window for the first time.Additional Info
Reproduction
package.json
index.html
Simply run
/path/to/nw /path/to/app
and observe theblur
event not triggering when removing focus from the application window for the first time./path/to/nw --disable-features=nw2 /path/to/app
works as expected.The text was updated successfully, but these errors were encountered: