Fixing Firefox's context menu

17 October 2018
Even though Slackware uses the ESR releases of Firefox, every time I upgrade comes with the possibility of some nasty surprises. This includes a pathological desire to keep changing the interface — there is an extension called Classic Theme Restorer that leaves no doubt as to what it is used for, but it seems that Mozilla still don’t get the hint. As usual for a major release, they have broken almost everything in sight, but there was one that took a lot longer than usual to sort out.

The problem

The latest annoyance is with the right-clicking pop-up menu: To avoid an immediate selection of one of the items — usually either going back one page or opening a link in a new window — you have to keep the button pressed and move the cursor a bit to the right. This is very annoying for people like me who often right-click and don't hold the button down before selecting a menu item.

The fix

The big break in working this out was a Reddit post. Within the Firefox profile directory — under Linux this is typically ~/.mozilla/firefox/${PROFILE} where ${PROFILE} is random characters) — add the following to /chrome/userChrome.css, creating it is it does not already exist:

#context-back, #context-openlinkintab, #context-openlink, #context-openlinkprivate { margin-left: 6px; }

These CSS changes shift the items near the top of the pop-up menu slightly to the right, so that the activation area — blue in the screenshot below — is away from the edge:

Content menu

This is not the only way to fix the problem via CSS, but this one suits me fine — I did not want to dive deeply into how Firefox structures all its styling.

Firefox's prognosis

If I want an off-the-shelf browser I go for Chrome, or its upstream open-source companion Chromium. They make the odd change, but by and large do not screw around with the interface. Stock Firefox without any extensions or customisations is awful, and with the frequency of complete breakage, it is no wonder Firefox’s popularity has collapsed down to 5%. I personally have stopped using it everywhere except on my main desktop, and I only use it on the latter because its anti-tracking extensions have tended to be superior to those of Chrome/Chromium. My tolerance has its limits.