feat: improve windows managemet when switching to popup [LW 12347] #1728
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
Proposed solution
Improve logic behind management of browser windows during switching to popup mode.
windowsWith3rdPartyTabs
) - they may also have any lace tabs. The preference is to open the popup in a window which does not close after we close all the lace tabs.windowsWith3rdPartyTabs
contains the currently focussed one, then it is put in at index 0. (candidateWindowsWithPreferenceForCurrentlyFocused
) - We prefer to open the popup in a window which is currently foccused. If the list does not contain a currently focussed window, it is fine; we will choose another one. The focussed one will close anyway after we close all lace tabs as it does not have any other tab.nextFocusedWindow
) - we take the first one fromcandidateWindowsWithPreferenceForCurrentlyFocused
(which may be the currently focussed one)nextFocusedWindow
is empty, then it means there are no windows with 3rd party tabs open. In this case, we want to choose any of the windows to be focused next and open an empty tab on that window so the window does not close when all its lace tabs get closed.Testing