After closing a tab, Firefox should always switch to an open adjacent tab when possible
Categories
(Firefox :: Tabbed Browser, defect, P2)
Tracking
()
People
(Reporter: denyshon, Assigned: dgraham)
References
Details
(Keywords: good-next-bug)
Attachments
(1 external file)
Steps to reproduce:
- Open three tabs (A, B, C) in a row.
- Unload tab C (or reopen Firefox and load only A and B).
- Switch to tab B and close it.
Expected results:
You are switched to tab A, which is already loaded. No new tabs get loaded.
Actual results:
You are switched to tab C, which starts loading, without a good reason.
| Reporter | ||
Updated•6 months ago
|
Comment 1•6 months ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Comment 2•6 months ago
|
||
Tabbrowser._findTabToBlurTo has a few criteria to avoid activating/selecting certain tabs, e.g. if they are hidden. The current code doesn't account for unloaded tabs, but it should be pretty straightforward to skip unloaded/lazy-loadable tabs. https://searchfox.org/firefox-main/rev/923c4d7d35ebb5693f5bda5dec9083f7c4f993b3/browser/components/tabbrowser/content/tabbrowser.js#6285-6359
Most of the complexity may come from fallback behavior. If all other tabs are unloaded, then we should blur to the next adjacent unloaded/lazy-loadable tab.
Comment 4•5 months ago
|
||
I am sorry, but I feel I am not ready yet to handle this bug, and asking for assignment was a mistake, I still have dealt with tabs states. Anyways I will give a summary for any future assignee, if it is any help.
Function takes aTab and excluded tabs (defaults to [])
Return null of tab is not selected,
Exclude firefox view (view recent browsing, found on top left) to avoid a certain bug
Return successor tab if it exists and not excluded (See 1)
Return tab owner if it is not null and visible and not excluded, and selectOwnerOnClose prefrence is true (See [2])
remainingTabs are visible tabs not excluded
use findNextTab and filter remaining tabs (forward then backward if nothing was found)
eligibleTabs are collapsed tabs in groups that are not excluded
use findNextTab and filter eligible tabs (forward then backward if nothing was found)
[2]: An owner tab is also known as an opener tab
(https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#openertabid)
This is a possible solution I came up, but could not complete as I am not sure how to get the tab state, (tried AsyncTabSwitcher, but that did not work):
Solution could be as simple as repeating the code but for arrays like loadedRemainingTabs, and loadedEligibleTabs
But perhaps it would be beneficial to create a function that takes these arrays as arguments to avoid repeating the code 4 times (or 8 times if counting both directions, or maybe even more for conditions I have not accounted for).
Either ways, there will be two extra arrays (or more), something like loadedRemainingTabs and loadedEligibleTabs that would filter for the tab state.
There is probably more nuance, for example there are these things called lazy-loadable tabs, and as I said I am not very proficient in this topic, so take what I say with a grain of salt and explore the bug to yourself.
Comment 5•5 months ago
|
||
Maybe useful links ([1], [2])
[1]: (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/moveInSuccession)
(https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#successortabid)
[2]: An owner tab is also known as an opener tab
(https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#openertabid)
| Assignee | ||
Comment 6•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
Comment 8•2 months ago
|
||
| bugherder | ||
Updated•2 months ago
|
Updated•1 month ago
|
Description
•