feat: Return to previous tab when closing tabs#11933
Merged
Merged
Conversation
mr-cheffy
requested changes
Jan 17, 2026
Member
mr-cheffy
left a comment
There was a problem hiding this comment.
I believe this is a hacky solution since you are simply allowing ALL tabs to have an owner (meaning you can close them, for example, with the back button, which is not what tab.owner is supposed to do).
Also, tab.owner might get cleared in some cases such as when opening a new background tab from the recently opened tab.
I think the fix rests around the _findtabtoblur (https://searchfox.org/firefox-main/source/browser/components/tabbrowser/content/tabbrowser.js#5859) function, where the next tab should be decided based on the last accessed time
lastAccessed time will be used to select the active tab instead of positional selection or ownership when a tab is closed, returning the user to their last used tab.
Contributor
Author
|
I removed the previous changes. Now, lastAccessed will be used to determine the last active tab, which will be switched to on tab close. |
mr-cheffy
approved these changes
Jan 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Removes the zen-newtab guard that prevents owner tab assignment when a new tab is created via hotkey or url bar. Closing a new tab will now return to the tab it was opened from.
Previously, closing these tabs would jump to the first regular tab instead of returning to the opener.
Ownership will not be assigned if multiple background tabs are created, but this matches current behavior. Single background tabs or newly created tabs will have ownership.
My testing hasn’t shown any other changes in behavior.
Fixes #11775