Firefox – Why does the active Firefox window occasionally lose focus

firefoxfocusgnomegnome3window focus

Occasionally, when I transition from one tab to another, the Firefox window loses focus. This is especially notable when I switch or close tabs via keyboard shortcuts. For example, I can be closing a bunch of tabs with Ctrl+w and suddenly it stops working. I have noticed that the Firefox window title is grayed out, indicating that the window has lost focus. Alt tabbing or clicking the window regains focus, but this is disruptive to the browsing experience.

To test if another application is stealing focus from Firefox, I kept this line running in a terminal

while true; do sleep 20; xdotool getwindowfocus getWindowname; done

which prints the name of the currently active window to stdout every 20 s. When Firefox loses focus, no window title is printed (just a newline), indicating that there is no other application that steals the focus from Firefox. Firefox is the only application that displays this behavior.

I am on Firefox 47.0 on Antergos (Arch derivative) Linux with Gnome 3.20.2 and kernel 4.6.2.1. Why does this happen and what can I do to make Firefox stop losing the window focus?

Best Answer

Firefox losing focus is usually caused by one (or more) add-on(s).

This is easily tested by running Firefox in safe mode. If the problem then disappears, then one can turn off add-ons selectively, until the guilty add-on(s) is(are) found.

There have been reports about the Flash add-on, and as the poster has found out, a combination of the add-ons ThumbnailZoomPlus and Gnome3 can also cause this problem.