Configure what Firefox does when you close a tab

Martin Brinkmann
Sep 12, 2018
Updated • Mar 25, 2021
Firefox, Firefox add-ons
|
17

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

configure firefox tab open after close

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:

  1. If there is a last accessed tab, select it.
  2. If there is none, select the tab to the left of the closed one.
  3. 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.

Summary
software image
Author Rating
1star1star1star1star1star
4.5 based on 3 votes
Software Name
Select After Closing Current
Software Category
Browser
Landing Page
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Evi1M4chine said on March 8, 2020 at 5:35 pm
    Reply

    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!

  2. Ulli said on January 8, 2020 at 11:51 am
    Reply

    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.

    1. Martin Brinkmann said on January 8, 2020 at 3:32 pm
      Reply

      Kannst du in den Optionen mal gucken wie die Reihenfolge bei dir aussieht von Aktionen?

  3. Arcionquad said on September 15, 2018 at 3:58 am
    Reply

    A small change makes a big difference! Thanks for the article.

  4. ha said on September 14, 2018 at 5:07 am
    Reply

    A nice addon I have been using since firefox quantum.

  5. few said on September 13, 2018 at 11:51 am
    Reply

    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.

  6. TomTom said on September 13, 2018 at 1:26 am
    Reply

    Speaking of, I just found out about ffprofile.com. Very useful profile maker when creating a new installation/profile.

  7. John said on September 13, 2018 at 12:26 am
    Reply

    Funny how this add-on gets reviewed, the day after I made a post about it on Reddit!
    No one commented at all!

  8. dmacleo said on September 12, 2018 at 7:31 pm
    Reply

    tab mix plus does this too.
    events-tab closing section. few config options.

    1. Peterc said on September 13, 2018 at 8:24 pm
      Reply

      @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.

    2. dmacleo said on September 12, 2018 at 7:33 pm
      Reply

      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.

  9. Ray said on September 12, 2018 at 6:40 pm
    Reply

    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.

    1. Roland said on February 17, 2021 at 7:10 am
      Reply

      Hi,

      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.

  10. TelV said on September 12, 2018 at 5:35 pm
    Reply

    What I do is to pin a blank tab.

  11. Omar said on September 12, 2018 at 5:26 pm
    Reply

    Thank you so much . I like this in opera browser . Any method can do with google chrome ?

  12. flash said on September 12, 2018 at 5:23 pm
    Reply

    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.

    1. gwacks said on September 13, 2018 at 8:25 am
      Reply

      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
      Done! ;-)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.