18

I'm using a Laptop with Ubuntu 19.04, and while in Nautilus and Chromium I can get precise scrolling, it doesn't appear to be the case in Firefox. Here's a (short 30 second) demonstration video to show you what I mean: https://youtu.be/GeLQLZAp2lg

In Firefox, I have Smooth Scrolling, but not Precise Scrolling. In Chromium (and the Nautilus File Manager, and practically everywhere else) I have Precise Scrolling, as the video demonstrates.

  • uname -a: Linux MACHINE_NAME 5.0.0-16-generic #17-Ubuntu SMP Wed May 15 10:52:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Desktop Environment: Unity 7.5.0+19.04.20190304-0ubuntu1
  • Firefox version: `68.0b7 (64 bit)
  • Chromium version: 74.0.3729.169 (Official Build) Built on Ubuntu , running on Ubuntu 19.04 (64-bit)
  • Touchpad model (from xinput): DELL0767:00 06CB:7E92 Touchpad
  • Laptop model: Dell Inspiron 5567
  • 3
    Repro in Arch. I think the keyword you're interested in is "pixel scrolling", and acc. to some sources, you can make it work by putting MOZ_USE_XINPUT2=1 line to /etc/environment, and rebooting the system. I tried doing the export in bash, and starting Firefox from there, but it didn't work; but perhaps you may have better luck adding it to your environment… With all that said: this is sure a bug in upstream Firefox, and should be reported. – Hi-Angel Jun 05 '19 at 23:26
  • 1
    Thanks, @Hi-Angel! That does seem to have done the trick. – starbeamrainbowlabs Jun 08 '19 at 00:01
  • Could you post that as an answer please? – starbeamrainbowlabs Jun 08 '19 at 00:10
  • 3
    Setting MOZ_USE_XINPUT2=1 stopped working for me after upgrading from Ubuntu 18.10 to 19.04 (when launching Firefox from XFCE's launcher). Turns out GDK_CORE_DEVICE_EVENTS=1 is being set and is conflicting, thus the following fixes it for me: env -uGDK_CORE_DEVICE_EVENTS MOZ_USE_XINPUT2=1 firefox – pcworld Sep 03 '19 at 01:09

2 Answers2

21

This is a bug in upstream ("upstream" means, like, "original") Firefox. According to some sources this can be worked around by putting MOZ_USE_XINPUT2=1 to /etc/environment file, and rebooting (I tried exporting it directly in bash and running Firefox, but it didn't work for me, putting it to environment seems to work at least for the OP here).

For some reason I haven't found the upstream report about scrolling. I found though this report on launchpad that asks Ubuntu to package Firefox with MOZ_USE_XINPUT2=1 by default, which in turn has comments with links to some related upstream bugreports. FWIW, the reason they don't package it with the env. variable by default is summed up in one of comments by Nate Graham:

The problem is that setting the envar just substitutes some problems with different ones:

  • Without this envar set, there is no touchscreen scrolling, and touchpad scrolling goes three lines at a time rather than pixel-by-pixel

  • With this envar set and a notification appears, touchpad scrolling is interrupted and mouse wheel scrolling stops working entirely until Firefox is de-focused and re-focused

The correct solution is to fix these bugs, not toggle between two broken states

Hi-Angel
  • 4,915
  • Thanks! I see. Not sure I've come across that bug before. Maybe I should open an issue? Would this be against the launchpad.net Firefox (i.e.e a packaging bug), or against Firefox itself? – starbeamrainbowlabs Jun 08 '19 at 19:13
  • 1
    @starbeamrainbowlabs since this is reproducible in upstream Firefox, this should be the report against Firefox itself, i.e. https://bugzilla.mozilla.org/home As a word of caution: I'm pretty sure, your report will be closed as a duplicate of ones that the launchpad report referred to. Most likely of this one. Still, IMO it would be nice to have an explicit report about the scrolling; and I also personally don't consider pinging from time to time developers with distinct reports that actually have the same root cause a bad thing. – Hi-Angel Jun 08 '19 at 20:52
  • 1
    Indeed, adding this flag to the environment is still necessary and sufficient in 2024. – Joel Sjögren May 05 '24 at 17:20
  • The only thing that worked for me in 2025, on Arch + Xfce, thanks! – Egor Tensin Mar 06 '25 at 12:55
5

This wasn't mentioned here yet, but I had to uncheck 'Smooth scrolling' in Firefox settings for this to work.

  • This makes such a huge difference - thank you! It feels so much better without smooth scroll enabled. Now see if it syncs this setting across my other devices, or whether I'll have to disable that. – starbeamrainbowlabs Oct 12 '19 at 11:05
  • 3
    Not for me. I couldn't see a difference in two-finger-scrolling with Smooth scrolling enabled/disabled. Maybe it was fixed in the meantime? – Manuel Apr 20 '20 at 21:37
  • It does make a difference for me. With the env var and smooth scrolling enabled, I did get pixel precise scrolling, however the viewport did still "lock" to the scroll positions about every three lines. Basically it only did track pixel perfect as long as I had two fingers on the trackpad and snapped once I let go. With smooth scrolling off, I can let go anywhere and the viewport stays there. – Crazor Feb 11 '23 at 14:23