I use Firefox 140.3.0esr on Linux. Debian 13. Xfce. X11. Intel GPU. 1980 x 1080 resolution. Dark theme set in both OS and Firefox. This also happened on Plasma, and on a completely different computer. I think that it has nothing to do with my hardware/setup and everything to do with how Firefox works.
Every day, I many times experience these horrible “flashes” in Firefox when loading pages, closing tabs or launching URLs from scripts/terminal. I’m going to focus on the last scenario for this question, because it’s the only one I can reliably reproduce and which doesn’t seem to happen “randomly”:
- Open in Firefox a webpage with bright white background, such as: https://www.thesaurus.com/browse/test
- Go to some other program, such as a text editor, as long as Firefox isn’t focused/visible.
- Run the terminal command (I have it set up as a hotkey):
firefox http://127.0.0.1/test.html. (test.html on my machine has a dark background. I tried to find an actual, public webpage with a dark background for this example but couldn’t find one.) - The Firefox window now focuses itself, briefly displays the bright webpage for a split second, and only then opens a new tab with the requested, dark webpage.
The result is a bright white “flash”. I’ve resorted to closing my eyelids before pressing the key, but I often forget to do so and it completely takes me out of my “flow” as I’m working.
What it should be doing is of course to focus Firefox only after it has created a new tab and switched to it, so there is no brief rendering of the previously opened page. Why wouldn’t it do that by default? Or at least wait until the new tab has been “created” before displaying Firefox?
I’ve carefully looked through the output of firefox -h without finding any flag for this. I’ve also tried all sorts of suggestions found online to fix what seems like one of the many decades-old “we refuse to fix it for some reason” bugs in Firefox. None work.
I even have set various “set background to dark” (for new tabs/default background/etc.) CSS rules in my userChrome.css and userContent.css files, attempting to force darkness. But if it has any effect at all, it’s not enough. The flashing keeps happening.
And the bright webpages often have no dark mode, but even if they did, it would be an “ugly hack” rather than a robust, general solution. Also, since I clear all browser data at least daily, it would require me to keep manually setting it in many cases. (Wikipedia/Wiktionary, for example, doesn’t auto-detect this and force you to manually select the dark theme, storing the choice in a cookie or similar.)
I also tried to make a Tampermonkey script to force darkness on specific webpages (a desperate, bad measure), but even that doesn’t work; still flashes.
The --new-tab flag doesn’t do anything differently, and --new-window would open a new window/instance which is not what I want. It has to use my currently opened Firefox, or open it if there is none running (which is rare).
As I’ve tried countless suggestions already, I know all too well that some seem to work “in certain situations”, but I’m obviously looking to get rid of the “flashing” completely. It’s indescribably annoying and I can’t believe the amount of time and energy I’ve wasted on this (and other stupid things) instead of getting any “real work” done.
This “flashing” makes it feel as if I’m using flimsy pre-release software. Something is horribly wrong somewhere, but apparently it doesn’t happen to everyone since it’s not been fixed for so long. If I were a Firefox developer, actually using the browser myself, this would be the #1 priority for me to fix ASAP.
In my desperation, I’ve even started thinking crazy thoughts such as making my own proxy server to fetch webpages indirectly, processing them before displaying them to my Firefox, just to force them to be dark as to avoid the flashes… It’s not that it’s intolerable that some webpages are bright and some dark, which can only be expected, but rather the brief “flashing” that becomes the result of this when Firefox “lingers on” with its rendering, or whatever is actually happening.
In the past, I’ve recorded my screen and then watched the resulting video frame-by-frame to verify that these “flashes” really do happen. I’ve tried so many things to fix this by now that I’ve probably forgotten to mention most of them here. Is there really no way to make this Hell stop?