-
Notifications
You must be signed in to change notification settings - Fork 970
Certain macOS / OS X menu items don't open a window if one isn't already open #8164
Comments
Marking as good first bug (also, I edited the original issue after fixing the new session tab issue) The solution is pretty easy- commonMenu.js has a method we can call (named Click here for an example that shows how to use the call properly (used for opening a new tab) |
For me a lot of menu items are fixed for reopening with zero brave windows open. E.g.: "About brave". "Import Browser Data" is still not working and adding Probably the "hard to tackle" menu items are still not working. Eg.: "History home" lives in menu not commonMenu where
If anyone can offer help how to deal with |
Is this still available, may I take this over? @bsclifton Thanks! |
@arsalankhalid absolutely 😄 I'll self-assign to reserve it for you |
OK Great :) Will take a stab |
I'm not able to re-create this, i've removed all my apps, started up again and then attempted to start a new session. But no banana, are we sure this issue still exists? |
Yes, this still an issue. Here's a GIF of me showing/testing |
Ah much clearer, thank you. Will give it a shot! |
Still an issue using STR:
|
Hi @bsclifton . I've been going through the good-first-bugs and identified this as something I'd like to try my hand at. ( This would be my first contribution to the project as well as open source in general for a while so I hope you don't mind ). Anyway I debugged this issue and I've found out that it's being caused ( at least in the case of the "About Brave" action ) due to the existence of the 'Buffer Window'. The app thinks that a window is still open in the getAllWindows() call. I'm going to try my best to put in a PR tonight. I hope you wouldn't mind. Thanks! |
When closing last window, make sure buffer window is closed so that app exits
@armaanahluwalia your help is definitely welcomed 😄👍 The buffer window optimization is fairly new- so I doubt this is the root cause for the issue. You should be able to check out the |
@bsclifton I'll look into it further but as per my last investigation, the reason that the about brave option wasn't working is because on macOS the getAllWindows() call thinks there is a window open even though there isn't. This is caused by the buffer window not being closed when all windows are closed due to line 341 of commit 12aa8b . Will double check I'm right and address the other parts of this bug too but thought I'd put this down in case it helps anyone else out. Thanks for the info though regarding the reasoning for the buffer window. |
@bsclifton I think that also brings up another point of wrapping the getAllWindows function to exclude the buffer window since people calling the function should be shielded from the workings of the buffer window solution. Perhaps have another api call such as getAllRealWindows or something like that and if you want the buffer window to be included then call the original function |
@armaanahluwalia I agree, I think I may have considered a function in the past but didn't see a need for it yet. |
Fix #8164 Fix #13689 This bug was caused because menu items were using a hidden window for their new tabs. We should _not_ use `electron{.remote}.BrowserWindow.getAllWindows()` or `.get{Active, Focused}Window` directly. There are two reasons that could have bad results: 1. We create BrowserWindows which are not normal tabbed renderer windows (e.g. some code that runs on Bookmark creation) 2. We have a hidden window sometimes (the Buffer Window) Instead call `app/browser/window.js`: `getAllRendererWindows` and `getActiveWindowId`. Fix for main menu actions, which can be called when there are no windows, but when searching for `BrowserWindow.` Test Plan: - Check all menu items open new tab in currently active window - Check all menu items open new tab in currently active window, when app is not focused - Check all menu items open new tab in new window if there is no visible window - Check tabs in all windows are persisted on restart when app / windows close - Check process quits in Windows when last visible window is closed
Fix #8164 Fix #13689 This bug was caused because menu items were using a hidden window for their new tabs. We should _not_ use `electron{.remote}.BrowserWindow.getAllWindows()` or `.get{Active, Focused}Window` directly. There are two reasons that could have bad results: 1. We create BrowserWindows which are not normal tabbed renderer windows (e.g. some code that runs on Bookmark creation) 2. We have a hidden window sometimes (the Buffer Window) Instead call `app/browser/window.js`: `getAllRendererWindows` and `getActiveWindowId`. Fix for main menu actions, which can be called when there are no windows, but when searching for `BrowserWindow.` Test Plan: - Check all menu items open new tab in currently active window - Check all menu items open new tab in currently active window, when app is not focused - Check all menu items open new tab in new window if there is no visible window - Check tabs in all windows are persisted on restart when app / windows close - Check process quits in Windows when last visible window is closed
#- Did you search for similar issues before submitting this one?
Yes
On OS X (and, I assume, macOS), if you have Brave open without any open windows and select
File -> New Session Tab -> New Session Tab 1
, no window opens. SelectingNew Tab
orNew Private Tab
will properly open a new window with the new tab, butNew Session Tab
does not.Other menu items also do not open a window when one is not already present. Here's a list of ones I've found:
Brave -> About Brave
Brave -> Import Browser Data
Brave -> Help Center
File -> New Session Tab -> New Session Tab 1
File -> Open Location
History -> Home
History -> Clear Browsing Data
History -> <any recently closed>
History -> Show History
Bookmarks -> Import Browser Data
Bookmarks -> <any actual bookmarked URL>
Shields -> Site Shield Settings
Help -> Help Center
All the other menu items seem to work appropriately, but feel free to double check.
OS X 10.11.6
0.14.1 (3de60d5)
Steps to reproduce:
Actual result:
Nothing happens.
A new window should open with the session tab or other appropriate page.
Yes.
Yes.
Yes.
The text was updated successfully, but these errors were encountered: