Matthew Miner's Basic-ish BlogMatthew Miner's Blog

Sometimes I might say something

How to Undo Firefox's "Close Tab Options" Changes?

TECH FIREFOX
Left: The new tab context menu in Firefox 78
Middle: The new tab context menu after adding extensions
Right: The new tab context menu after all changes (Also how the old menu looked)

When you right-click a tab, Firefox historically has had two options in the context menu that let you close multiple tabs at once: "Close Tabs to the Right" and "Close Other Tabs". These are self-explanatory and very useful buttons for people who do a lot of browsing and utilize both windows and tabs. However, in Firefox 78, Mozilla has moved these items into a submenu, largely eliminating their time-saving ability.

The Firefox 78 tab context menu showing the Close Multiple Tabs menu

This was justified by worries that people were closing too many tabs accidentally. However, if you are one of the many people who liked the ease-of-use these buttons provide, it is possible to restore them.

The bulk of the work enabling one to do this was done by Michał Kopeć with his two extensions:

However, these extensions cannot simply undo the changes Mozilla has done. They simply readd the options to the bottom of the context menu, leading to this:
Context menu with both "Close Multiple Tabs" and the subitems separately

If you are happy with this, you can stop here and continue with your life. However, I was not. To move these items up to the old place and hide the new menu, I used a userChrome.css file. Getting this file created and positioned right takes a few minutes, but userChrome.org explains how better than I could. To summarize though:

  • Go to the URL about:support
  • Click "Open Folder" next to "Profile Folder" in the middle of the first table
  • Make a new folder called "chrome"
  • Make a file in that folder and name it "userChrome.css"
  • Put the code later in this post in that file (Or just download this one (right-click and hit "Save Link As..."))
  • Go to the URL about:config
  • Toggle toolkit.legacyUserProfileCustomizations.stylesheets to true
  • Restart Firefox

As for what to put in your userChrome.css file, you will want to include the following styles:

/*** Undo "Close Tab Options" ***/
  /* Hide "Close Tab Options" menu */
  #context_closeTabOptions {
    display: none !important;
  }
  /* Move "Close Tab Options" items from extensions up to old positions */
  #context_undoCloseTab,
  #context_undoCloseTab ~ * {
    -moz-box-ordinal-group: 3;
  }
  #_588c6fa6-14f9-4826-b769-71a305c80bbb_-menuitem-_close_right {
    -moz-box-ordinal-group: 1;
  }
  #_a02f4411-7950-4b43-abcd-23a01a9ce719_-menuitem-_close_other_tabs {
    -moz-box-ordinal-group: 2;
  }
/*** End of: Undo "Close Tab Options" ***/

However, if these are the only extensions adding items to the tab context menu, you will be left with an ugly menuseparator left at the bottom of the context menu:
Context menu with a menuseparator at the bottom

To fix this, you can add one more style to your userChrome.css:

/*** Hide Tab Context Menu's Last Menu Separator ***/
  #tabContextMenu > menuseparator:last-of-type {
    display: none !important;
  }
/*** End of: Hide Tab Context Menu's Last Menu Separator ***/

Or, again, you could just download this one by right-clicking and hitting "Save Link As...". Either way, once you have your userChrome.css file set up and Firefox configured, you should be able to restart it and see this:
Context menu showing "Close Tabs to the Right" and "Close Other Tabs" above "Undo Close Tabs"

Voila, just like before! (Until Mozilla breaks stuff again)

Previous Post