How to get Mouse buttons 4 / 5 (Browser back / Browser forward) working in Firefox?
Asked Answered
T

6

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?

Tympanitis answered 27/3, 2020 at 23:56 Comment(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!Gabbi
Having this issue on Firefox Mac with a Logitech MX Master via bluetooth. It actually seems to activate middle-click.Bothnia
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).Bothnia
@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 ```Tympanitis
@Tympanitis 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.Bothnia
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.Audie
As described in this answer the bug is now fixed. Case closed.Ricoriki
R
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.

Ricoriki answered 26/7, 2021 at 14:49 Comment(4)
Great news! Can't wait to finally squash this bug!Tympanitis
Tried the Nightly and can confirm it is fixedBellis
Firefox 92 released in Ubuntu 20.04 LTS repos as of 2021-09-09 !! I can confirm that this bug is fixed in Linux and MacOS with Logitech MX Master 2S and MX Master 3 mouses!Tympanitis
Confirmed in Release version of Firefox 92.0.1Craps
C
14

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

Concepcion answered 21/10, 2020 at 9:59 Comment(3)
This do the trick! Work not only with Logitech mouse.Undergraduate
SensibleSideButtons interferes however with applications like VSCode.Sagacity
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 of this project.Concepcion
R
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.

Ricoriki answered 26/7, 2021 at 14:49 Comment(4)
Great news! Can't wait to finally squash this bug!Tympanitis
Tried the Nightly and can confirm it is fixedBellis
Firefox 92 released in Ubuntu 20.04 LTS repos as of 2021-09-09 !! I can confirm that this bug is fixed in Linux and MacOS with Logitech MX Master 2S and MX Master 3 mouses!Tympanitis
Confirmed in Release version of Firefox 92.0.1Craps
G
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
Gorton answered 24/11, 2020 at 16:14 Comment(3)
It turns out this was it! However, there are apparently now some extra steps. 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 OptionsTympanitis
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!Tympanitis
Unfortunately, this solution won't work for wired mice as "Logitech Options" is expecting a USB dongle... and I have a M500s (M-U0007).... :-(Grahamgrahame
D
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!

Divalent answered 16/10, 2020 at 15:20 Comment(1)
Unfortunately this didn't work for me, have the same issue (but only in firefox)Concepcion
S
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

Shayna answered 6/7, 2021 at 16:38 Comment(0)
B
0

I actually want the buttons to stop working :) because I have lost one too many replies in a browser form when I accidentally hit the back button.

So if you prefer that the forward and back buttons do nothing in Firefox, go into its about:config screen, on the "Proceed with caution" screen click the "Accept the risk and continue" button, enter "mousebutton" in the textbox at the top, then you should then see just these entries:

   mousebutton.4th.enabled      true
   mousebutton.5th.enabled      true

Click the left/right arrow icon at the right in each row to change the value to "false". The value is automagically saved. After this change the forward and back buttons should stop forwarding and backing.

I tested these instructions on Firefox 118.0.2 for mac. HTH

Bocage answered 25/1 at 14:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.