40

First, I need to say that I'm aware there is some confusion as to what button numbering scheme convention is used for these "Browser back" and "Browser forward" mouse buttons depending on whether you use numbering starting from zero 0 or one 1. Since this question is about Firefox, I'll go by Mozilla's numbering scheme here.

I've been struggling with an issue seen only in Firefox where Mouse buttons 4 (back) and 5 (forward) appear to Firefox as if they were a button 2 click (Middle button click) event. Pressing either button 4 or 5 results in the circular "autoscrolling" icon with Up and Down arrows appearing:

Firefox autoscroll icon

I've done some debugging using this Mouse Event Test Page. Results are different between Chrome and Firefox. It appears that the "which" JS event attribute numbers these as 4 and 5, while the button attribute numbers them as 3 and 4. Regardless, Google Chrome interprets them as "Browser back" and "Browser Forward" buttons correctly, while Firefox does not.

  • Chrome:

    • Mouse Button "4" (back)

      mousedown   which=4 button=3 buttons=8
      mouseup     which=4 button=3 buttons=0
      
    • Mouse Button "5" (forward)

      mousedown   which=5 button=4 buttons=16
      mouseup     which=5 button=4 buttons=0
      
    • Mouse Button "2" (middle click)

      mousedown   which=2 button=1 buttons=4
      mouseup     which=2 button=1 buttons=0
      
  • Firefox:

    • Mouse Button "4" (back)

      mousedown   which=2 button=1 buttons=8
      mouseup     which=2 button=1 buttons=0
      
    • Mouse Button "5" (forward)

      mousedown   which=2 button=1 buttons=16
      mouseup     which=2 button=1 buttons=0
      
    • Mouse Button "2" (middle click)

      mousedown   which=2 button=1 buttons=4
      mouseup     which=2 button=1 buttons=0
      

As the page says, not all browsers work correctly. It also states:

However, in some browsers, the defaults cannot be disabled, so various strange side effects may occur.

In Firefox, I notice clicking with all three of these buttons launches a new tab with javascript:void(null). This is the same as the link's URL attribute (href="javascript:void(null)"), as we can see from that page's source code. So this behavior is consistent with a Middle Button Click event, which usually will launch a new tab with that URL.

Is it possible to get these buttons for "Browser Back" and "Browser Forward" working properly in Firefox?

TrinitronX
  • 4,959
  • 3
  • 39
  • 66
  • 7
    Having this same issue on a Mac, with a non-Apple mouse. Back and forward buttons work on Chrome, and not on Firefox. Yet, I use the mouse in Linux and it all works fine. Frustrating! – Michael Jun 09 '20 at 14:04
  • 1
    Having this issue on Firefox Mac with a Logitech MX Master via bluetooth. It actually seems to activate middle-click. – Phil Ricketts Jul 17 '20 at 12:50
  • I have had some other weird problems with mouse events in MacOS (10.15.4 – latest), sometimes including the touchpad so this may in fact be an MacOS bug in itself. I also have problems with the Logitech Options software, which theoretically could provide a solution to this Firefox problem via per-application mouse button overrides (keyboard assignment). – Phil Ricketts Jul 17 '20 at 13:25
  • @PhilRicketts same mouse here: Logitech MX Master with latest "Logi Options" software installed. The two buttons are mapped to default: "`Forward`" and "`Back`" keys. Checking for keyboard & Mouse events using `xev` command on macOS shows that _**only the middle mouse button**_ is yielding press & release events like the following: ``` ButtonPress event, serial 34, synthetic NO, window 0x600001, root 0x111, subw 0x600002, time 1694483061, (33,35), root:(33,58), state 0x0, button 2, same_screen YES ``` – TrinitronX Jul 19 '20 at 02:58
  • 1
    @TrinitronX It is mostly working for me now in Firefox, though ocasionally it stops working again, and I'm left with middle-click actions, as you describe. I also sometimes encounter pointer slowdown with the MX Master, but I installed `USB Overdrive` prefpane to increase polling rate, as a desperate attempt to fix that. Related: my mouse becomes choppy ocassionally while listening to bluetooth headphones. Opening `USB Overdrive` prefpane fixes it, strangely, which leads me to believe that this is some kind of Mac bluetooth bug. Also, I've had two MX Masters with the same issues. – Phil Ricketts Aug 05 '20 at 13:10
  • I have this exact issue with FF on macOS. There's no additional software/drivers for my mouse though. It's just a basic wireless mouse. Has anyone figured this out? I'm shocked that FF has a bug like this. Works fine on Chrome. – skainswo Aug 16 '20 at 20:53
  • As described in this [answer](https://stackoverflow.com/a/68532003/13226740) the bug is now fixed. Case closed. – Tino Sep 07 '21 at 14:03

5 Answers5

14

I can recommend the SensibleSideButtons project. It’s easy to install, and it will fix those mouse buttons in many other programs, too.

Rory O'Kane
  • 29,210
  • 11
  • 96
  • 131
Fabian Schmick
  • 1,616
  • 3
  • 23
  • 32
  • 1
    This do the trick! Work not only with Logitech mouse. – Jupeter Jan 22 '21 at 08:40
  • SensibleSideButtons interferes however with applications like VSCode. – simou Mar 12 '21 at 10:37
  • Didn't try it in VSCode. But I'm working with Jetbrains PHPStorm and can say there are no such issues. But good to know there are troubles in VSCode. Maybe you can have a look at the [github issues](https://github.com/archagon/sensible-side-buttons/issues) of this project. – Fabian Schmick Mar 12 '21 at 14:29
9

GOOD NEWS: Bug Fixed in FF 92

The bug is fixed and the fix will be included in Firefox version 92 which will be released in early September 2021.

In the current Nightly Build (version 92) it is already working and you can use the Mouse Buttons 4 and 5 as expected for browser navigation back and forward.
I tested it with MacOS and an ordinary Dell mouse.


UPDATE (September 7, 2021)

Firefox 92 was released today as described earlier and the mouse buttons 4 and 5 work like a charm
Case closed.

Tino
  • 646
  • 2
  • 9
  • 15
7

I had the same issue.

System Information

  • macOS 10.15.5
  • Firefox 83.0
  • Logitech MX Master 2S Wireless Mouse

Steps to Reproduce

  • Open Firefox.
  • Navigate to page.
  • Click back, click forward.

Resolution

  • Install Logitech Options for macOS.
  • Open application.
  • Allow application to control your computer: System Preferences > Security & Privacy > Accessibility > Check Logi Options and Logi Options Daemon
  • It turns out this was it! However, there are [apparently now some extra steps](https://support.logi.com/hc/en-us/articles/360023203954#h_29d3b1f8-6a15-42d7-9959-d43e1846c671). I had to add `Logi Options Daemon` to `Accessibility`, `Input monitoring`, and `Screen Recording`. Some of these were missing both `Logi` items to check, so I added them manually by clicking the `+` icon and navigating to: `/Library/Application Support/Logitech/Logitech Options/Logi Options Daemon`, and `/Applications/Logi Options` – TrinitronX Dec 02 '20 at 16:37
  • One other important note after experimenting a bit: The back / forward **and** mouse wheel buttons stopped working again after I tried to remove and re-add the `Logi Options Daemon` to each of these settings for testing purposes. The only thing that fixed it was a complete uninstall, reboot, re-install, reboot, and finally go into each of those `System Preferences > Security & Privacy` sections to **uncheck & re-check each `Logi*` item again!** When prompted to restart each program, do it! Somehow these settings were stuck in an non-operational state until that final step! – TrinitronX Dec 03 '20 at 22:06
  • Unfortunately, this solution won't work for wired mice as "Logitech Options" is expecting a USB dongle... and I have a M500s (M-U0007).... :-( – AlexD Apr 27 '21 at 22:03
1

Had the same issue with a Logitech MX Master 3 / MacOS 10.15.7 / Firefox 81.0.2 (back/fwd buttons suddenly stopped working for no discernable reason). A NVRAM / PRAM reset fixed it for me!

1

it's not vendor specific issue. Any multi button mouse might be affected by that.
Solution: karabiner-elements. Installing instructions on site. Otherwise for brew users as simple as:

brew install karabiner-elements

Open karabiner-elements and give it all permissions it needs.
In the program interface itself navigate to devices and add a mark on the thick box next to your mouse device. Go to "Complex Modifications", then click on "Rules" -> "Add rule" -> "Import more rules from Internet".
In the newly opened browser window search for "Change mouse buttons (rev 2)" and press the big blue "Import button". Upon successful import, make sure to enable the combination that suits you most.

For Logitech MX master (the original one where down side button is back and upper side button is forth) the profile to enable is "Change button4,5 to back forward".

As extra you get the nearly endless combinations and remaps Karabiner can provide