Configure what Firefox does when you close a tab
What happens when you close a tab in the Firefox web browser? If only one tab is open, Firefox will close. If multiple tabs are open, Firefox will open the last activate tab in the browser provided there was one.
If there was none, Firefox will load the tab to the left of the closed tab or the tab to the right depending on the closed tabs position in the tab bar of the browser.
While you can prevent Firefox from closing windows when the last tab is closed, by settingÂ browser.tabs.closeWindowWithLastTab to false on about:config, it is not possible to change the order which Firefox consults to decide which tab to activate when a tab is closed.
Tip: find out how to restore closed tabs fasterÂ in Firefox.
Select After Closing Current
Select After Closing Current is a Firefox extension that gives users full control of the order when a new tab needs to be activated because the current one is closed.
The extension displays Firefox's default order in the interface after installation; means, nothing changes right after installation. You need to open the extension's settings, by loading about:addons and clicking on options next to Select After Closing Current, to change the order.
You can add and remove entries from the list of actions. The extension checks each starting with the one at the top and selects the first that matches the situation.
This looks like the following for the default configuration:
- If there is a last accessed tab, select it.
- If there is none, select the tab to the left of the closed one.
- If there is none, select the tab to the right of the closed one.
The extension supports the following options:
- Position: first, last, left, or right.
- Relation: tab, last accessed tab, parent tab, sibling tab, child tab, unread tab, unread child tab.
You combine position with relation to create new rules. Some examples:
- open the first unread tab.
- open the first unread sibling tab.
- open the first unread tab to the right.
- open the last child tab.
Use the up and down arrow buttons to move a rule and change the order of all rules in the process.
Select After Closing Current supports five keyboard shortcuts that you can configure. Select a key on the keyboard and modifiers, and assign each shortcut to a particular rule. Each shortcut closes the current tab and activates the assigned rule afterward.
Closing Words and verdict
Select After Closing Current is a useful extension for the Firefox web browser to change processing rules when a tab is closed in the Firefox web browser. The option to assign shortcuts to specific rules is handy as well as it ensures that the particular rule is executed provided that it is possible.
Thanks for this post. I had thus far been using the extension “Tab Open/Close Control” by F. Kolbe (https://addons.mozilla.org/en-US/firefox/addon/tab-open-close-control/) but after testing this one you advertised it seems to work better, more reliably and has extra setting options. Awesome.
I’d like to share my very rules with you guys. First of all, set browser.tabs.insertAfterCurrent to true, then try selecting in this order:
First unread child tab >> Right sibling tab >> left sibling tab >> Parent tab >> Last accessed tab
Thank you so much . I like this in opera browser . Any method can do with google chrome ?
What I do is to pin a blank tab.
All these tab extensions have one problem when attempting to focus the last active tab: They have to temporarily focus the tab to the right before reactivating the last active tab.
This one even mentions this in the addon description:
“The tab that Firefox selects by default may be selected and shown briefly. This is because Firefox 57+ compatible extensions cannot access Firefox’s internal working, so the browser’s default selection cannot be prevented. This extension can only fix it afterwards.”
Hopefully, Firefox can extend their tab API so this isn’t necessary in the future.
would it be possible to first change the focus to the tab you want and then close the old one?
Like I want to have the focus on the tab to the left if I close a tab.
So If there could be a script or something that goes one tab to the left (like CTRL+SHIFT+TAB) and one that closes ONE tab to the right and then combine these two.
It wouldn’t necessarily have to catch the close tab button (the X in the tab handle), I would already be happy to be able to assign it to a hotkey (catching CTRL+w and assigning it to that function would be ideal, as I seldom use the X and mostly CTRL+w to close tabs.
tab mix plus does this too.
events-tab closing section. few config options.
oops didn’t see this has more options on the order of stuff.
still, I only use option to prevent accidental closing of browser so TM+ works well for me.
@dmacleo: To my knowledge, Tab Mix Plus is an unsupported legacy extension in current versions of Firefox. Firefox doesn’t support XUL/XPCOM extensions at all anymore, and its current WebExtensions framework is missing a large number of APIs that Tab Mix Plus needs in order to work — or at least offer more than a small fraction of the functionality it offered in pre-WebExtensions Firefox.
Tab Mix Plus 0.5.0.4 seems to be working perfectly in the most recent deprecated (outdated) major releases of Firefox ESR (52.9.0), Tor Browser (7.5.6), and Pale Moon (27.x), and Tab Mix Plus 0.5.5.0 seems to be working almost perfectly* in current Pale Moon (28.x). I’m guessing that one version or the other of Tab Mix Plus also works perfectly or almost perfectly in Waterfox and Basilisk. But I’m not seeing a way to use Tab Mix Plus in the current releases of Firefox Quantum (62.0) or Tor Browser (8.0).
Along with Session Manager, DownThemAll, and Download Status Bar, Tab Mix Plus is one of my favorite extensions. None of these extensions is supported in Firefox Quantum, and even more than interface customizability, they are the main reason I’ve stuck with Pale Moon as my primary browser. All of the “equivalent” WebExtensions add-ons I’ve seen seem like pale, clunky, incomplete substitutes at best.
*By “almost perfectly,” I mean that the “Display Opened Tabs List” toolbar button doesn’t work. Everything else I’ve tried does.
Funny how this add-on gets reviewed, the day after I made a post about it on Reddit!
No one commented at all!
Speaking of, I just found out about ffprofile.com. Very useful profile maker when creating a new installation/profile.
do you mean what firefox does when you try to reopen a closed tab? because if you close a tab, it gets closed, nothing gets opened on its own.
A nice addon I have been using since firefox quantum.
A small change makes a big difference! Thanks for the article.
Mein Englisch ist leider nicht gut und ich habe immer noch nicht herausgefunden, wie dieses Addon funktioniert.
First Last accessed tab If there is a last accessed tab, select it.
Bei mir wurde immer der erste Tab aktiviert (ganz links) und nicht der zuletzt ausgewÃ¤hlte.
Kannst du in den Optionen mal gucken wie die Reihenfolge bei dir aussieht von Aktionen?
Usless. I need to configure it, so it stops downloading stuff for a page I already closed! Because, yeah, it does that. Even when you close the browser! You have to kill it, to stop it!
Which bogs down the entire line on a throttled mobile connection!