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

feat: improve windows managemet when switching to popup [LW 12347] #1728

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

szymonmaslowski
Copy link
Contributor

@szymonmaslowski szymonmaslowski commented Feb 19, 2025

Checklist

  • JIRA - <link>
  • Proper tests implemented
  • Screenshots added.

Proposed solution

Improve logic behind management of browser windows during switching to popup mode.

  1. Get all windows
  2. From all windows, get those that have some 3rd party tabs (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.
  3. If 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.
  4. We select a window that will be focussed next (nextFocusedWindow) - we take the first one from candidateWindowsWithPreferenceForCurrentlyFocused (which may be the currently focussed one)
  5. If 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.
  6. We close all the lace tabs in all windows, no matter how many windows there are. Windows having only lace tabs will close. Those having 3rd party tabs remain open.
  7. We open the popup in the window that was nominated to be the next active (a currently active one or any other).

Testing

  1. Single window with only lace tab - should close lace, open empty tab and open lace popup
  2. Single window with lace and some other tab - should close lace, switch to other tab and open popup
  3. Two windows, active one with only lace and background one with some other tab - should close active window and open popup in background window
  4. Two windows, active one with lace and some other tab, background one with lace and some other tab - should close all lace tabs in all windows, switch to other tabs in all windows and open popup in active window

@szymonmaslowski szymonmaslowski requested a review from a team as a code owner February 19, 2025 13:01
@szymonmaslowski szymonmaslowski self-assigned this Feb 19, 2025
@szymonmaslowski szymonmaslowski force-pushed the fix/LW-12347-switchin-to-nami-issue branch from b29e275 to 277b499 Compare February 19, 2025 15:40
@szymonmaslowski szymonmaslowski force-pushed the fix/LW-12347-switchin-to-nami-issue branch from 277b499 to b3299fd Compare February 19, 2025 16:29
Copy link

sonarqubecloud bot commented Feb 19, 2025

@przemyslaw-wlodek
Copy link
Contributor

Great work @szymonmaslowski! 🚀 🫶

@szymonmaslowski szymonmaslowski merged commit 958032a into main Feb 20, 2025
30 checks passed
@szymonmaslowski szymonmaslowski deleted the fix/LW-12347-switchin-to-nami-issue branch February 20, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants