Firefox: Always open a New Tab after Current
— Kaushal ModiThe default behavior of Firefox opening new tabs from links had been troubling me for a while .. it was time I tried to do something about it.
This was one of the those little things in software that bug me, but I don’t start looking for a solution right-away because of reasons like “I am too busy with something else”, or “The bug is not so bad.. let me see if I can live with it”.
But no .. this particular issue with how Firefox dealt with opening new tabs from links was now getting on my nerves.
The Issue #
While visiting a page, I typically middle-click on links so that they open in new tabs .. and I do that a lot! And this is the order of where the new tabs would open:
In my view, this behavior is completely wrong!
As you can see above, if I already have a bunch of links open (see the last row where “Tab 1”, “Tab 2” and “Tab 3” are already open), the last opened tab will land up between those tabs and a sea of other previously opened tabs! When you have over a dozen of tabs already open, hunting for the last opened tabs is really annoying.
Expected Behavior #
I would instead expect for each middle-click to open the new tab immediately to the right of the current tab. Below diagram shows it very clearly that this behavior would save me the exercise of hunting for that new tab.
False Leads #
So I searched online for “firefox new tab location” and similar search terms, and found Q&A on Mozilla Support like How do I make tabs open on the right by default? and New tabs ALWAYS open to the right of the last open tab, not to the right of current tab.
The “Chosen solutions” for both of these issues suggested setting
browser.tabs.insertAfterCurrent = true
and
browser.tabs.insertRelatedAfterCurrent = true
(which is the default)
in the Firefox about:config.
But that didn’t work!!
Setting browser.tabs.insertAfterCurrent = true
affected the “new tab
opening” behavior when opening only blank new tabs using Ctrl+T
or
hitting the “New Tab” button.
This setting had nothing to do with the location of new tabs opened
by the “Open Link in New Tab” or “middle-click on link” action.
Firefox Bug # 1485683 #
After scouring through many search results, I landed up on Firefox Bug # 1485683: browser.tab.insertaftercurrent order which reported the exact same issue I was seeing 🎉.
So I replied to that bug thread confirming that I still saw that issue on Firefox 101.0.1 .. 4 years later .. just in case that motivates someone to still fix it.
But my issue isn’t fixed yet.
Solution #
Finally, the Open Tabs Next to Current (repo) Firefox Add-on saved the day!
The introduction of this add-on incorrectly states this:
After the addition of the
browser.tabs.insertAfterCurrent
setting in about:config you do not need this extension anymore.
But I still tried installing it to see .. just in case .. 🤞 ..
And it worked!!
I could finally get new tabs to open in the order as shown in the Expected Tab Order figure above 😂.
Thank you Sebastian Blask for Open Tabs Next to Current!