focus does not switch to firefox when a hyperlink is clicked in another application

Bug #546969 reported by linux4me
62
This bug affects 11 people
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: firefox

In Lucid Beta 1, Firefox 3.6+nobinonly-0ubuntu6:

When I click a hyperlink in Evolution or Ctrl+click a hyperlink in an Open Office document, I expect Firefox to open the link in a new tab and switch the focus to Firefox. This is what happens if Firefox is not already running; however, if Firefox is already running, the link is opened in a new tab but focus is not switched to Firefox.

Firefox is selected as the web browser in Preferred Applications where "Open link with web browser default" is selected. In Firefox -> Edit -> Preferences, "When I open a link in a new tab, switch to it immediately" is selected.

I'm not sure if this is a bug, or simply new default behavior. Judging by bug #481541, it may be the behavior preferred by some users. Perhaps the best solution would be to offer a configuration option so end users could select the default behavior?

ProblemType: Bug
Architecture: amd64
Date: Thu Mar 25 09:50:54 2010
DistroRelease: Ubuntu 10.04
EcryptfsInUse: Yes
FirefoxPackages:
 firefox 3.6+nobinonly-0ubuntu6
 firefox-gnome-support 3.6+nobinonly-0ubuntu6
 firefox-branding 3.6+nobinonly-0ubuntu6
 abroswer N/A
 abrowser-branding N/A
InstallationMedia: Error: [Errno 13] Permission denied: '/var/log/installer/media-info'
NonfreeKernelModules: nvidia
Package: firefox 3.6+nobinonly-0ubuntu6
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-16.25-generic
SourcePackage: firefox
Uname: Linux 2.6.32-16-generic x86_64

Revision history for this message
linux4me (ta2008) wrote :
Revision history for this message
greeny (greenlittlething) wrote :

I was just browsing firefox related bugs and spotted a funny thing. https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/481541 that is actually the exact opposite of this bug: "Firefox steals the focus from other apps when clicking on a link". I guess u guys need to figure out "who's right" and which behaviour is the one we should support because you can't have both.

Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

Just found that setting web browser option in Preferred Applications to "Open link in new tab" *does* change focus to Firefox. Same thing with "Open link in new window". This is a satisfactory workaround for me.

Revision history for this message
linux4me (ta2008) wrote :

Yes, I mentioned in my original post that it may be the behavior preferred by some. I think the best resolution would be to make it a user-selectable behavior because there may not be a "right" solution. I tried setting Preferred Applications to "Open link in new tab" but it didn't change anything for me. If Firefox isn't open and I click a link in another application, Firefox opens and gets the focus. If Firefox is open, the link is opened in Firefox but the focus doesn't switch.

Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

I have to retract my previous statement. Either I wasn't paying enough attention or the behavior changed. When I went changing Preferred Applications setting around, Firefox stopped taking focus unless "Open link in new window" was set. However, I found that Compiz has a setting:

/apps/compiz/general/screen0/options/focus_prevention_level

that when set from default of 1 to 0 (off) Firefox now takes focus. Also found this bug:

https://bugs.launchpad.net/ubuntu/+source/ubufox/+bug/272171

where someone mentions the same thing. Even if you're not using Compiz you might want to check the window manager settings to see if there is one that fixes it for you.

Revision history for this message
linux4me (ta2008) wrote :

@edemeulle:

Where are you finding /apps/compiz/general/screen0/options/focus_prevention_level?

Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

Oh, sorry. It's in gconf-editor.

Revision history for this message
rg (rob-themayfire) wrote :

There are clearly two opposing camps on this, the 546969'ers who DO want FF to take focus, and the 272171'ers who don't, so clearly this needs to be a preference somewhere. I'm one who DOES want FF to take focus, but alas, it is not, on a brand new install of 10.04 and FF 3.6.8.

I tried changing Preferences > Preferred Applications > Internet > Web Browser from "Open link with web browser default" to "Open link in new tab", and nothing changed. Then I rebooted, reopened FF, reopened Evolution, and the FIRST time I clicked a link in Evolution, it opened a new tab in FF and FF focused. But after that first time it's back to the old non-focusing behavior on all subsequent links (I'm guessing this is what confused edemuelle into reporting success too soon).

In bug 272171 they speak of browser.tabs.loadDivertedInBackground, but this is already false for me, and besides this only defines whether the new tab should be focused within FF, not whether FF should be focused in general.
http://www.mvps.org/dmcritchie/firefox/tabs_config.htm

The Compiz workaround does not work for me as I do not use Compiz (and this isn't a good reason to start).

edemuelle suggested checking "the window manager settings" -- I assume referring to gconf-editor as well. I've looked all through it and found nothing.

I'm at a loss!

Revision history for this message
rg (rob-themayfire) wrote :

After some more playing around, this gets even weirder:

1. Close Firefox
2. Click a link in evolution, FF focuses
3. Go back to evo and click another link, FF focuses
4. Repeat #3 as often as you want, get same result, feel happy.
5. Now stay in FF and open a new tab directly (ctrl-t) and maybe pull up any website
6. Go back to evo and click another link, FF does NOT focus!
7. Repeat #6 as much as you want, you will not get FF to focus again until you close all tabs and start over.

Buggage.

Revision history for this message
rg (rob-themayfire) wrote :

Now I've discovered that this same problem occurs with Chrome as my default browser. And it happens the same from other source applications such as terminal or nautilus. So it is not an issue with any of these apps in particular, which makes you think it's a GNOME problem. But then here's a post where someone claims to have the same issue in Kubuntu 10.04:
http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9265170

My entire workflow pretty much consists of getting notification emails from some web app and clicking a link to go to said web app to continue working. This new behavior is thus pretty maddening, and I would like to help fix it however I can, but I don't know which direction to keep investigating at this point... where does the focus-or-not decision even get made??

Revision history for this message
mundo (greg-janineharrison) wrote :

I have followed the steps stated by RG and can confirm that this is the behaviour in 10.04.

A preference to resolve this would be great to see in the next release. I find this a daily annoyance.

Revision history for this message
mundo (greg-janineharrison) wrote :

Forgot to mention that I am using Netbook Remix.

Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

For a while, I just kinda ignored this problem. I'm now on Natty. In case it's helpful I just found that if one changes the Compiz option Focus Prevention Level in General Options to Off that Firefox will take focus when clicking on links in Thunderbird.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in firefox (Ubuntu):
status: New → Confirmed
Revision history for this message
rg (rob-themayfire) wrote :

Update for people like me who like to understand what the #$& is actually going on:

Sometime in the last two years this problem went away for me. Then just the other day it mysteriously came back. After lots of reading I finally got it how I like it again, and learned that there have been multiple levels of bugs and settings making this extra confusing:

1. A <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=721498">FireFox bug</a> causing inconsistent behavior with links passed from external apps. This is what caused my original problem: if FF was not open yet, external links would focus it, but if FF was already open, external links would not focus it. As noted in that bug report, that doesn't make sense whatever your general focus preference is, and this was fixed in early 2012 so that FF DOES take focus in either case. Which made people like me happy, who prefer to always open external links in the foreground, but annoyed the people who prefer to always open external links in the background.

2. The <a href="http://www.techsupportalert.com/content/how-stop-firefox-stealing-window-focus.htm">Focus Prevention Level</a> compiz setting. People who were upset by the FF fix can use this setting to override what they (erroneously IMO) call FF's "focus stealing". Set it to at least "low" and it should block FF from taking focus, instead bouncing the icon in the launcher or flashing in the taskbar or whatever. Or, if you WANT FF to take focus when you click links from external apps, set this to "off". Back when I posted to this case in 2010 this fix did not help me, but now that the FF bug is fixed, it does.

3. The FF config setting browser.tabs.loadDivertedInBackground -- This gets brought up a lot but it is NOT RELEVANT to this issue. This setting (and the similar LoadInBackground) controls how tabs focus in relation to other tabs, not how FF focuses in relation to other apps. Everyone that's been talking about these settings has just been obscuring the actual problem and complicating the discussion.

There, hope this helps at least one person, and I will now shut up about it forever :)

Revision history for this message
Paul White (paulw2u) wrote :

Upstream issue showing "RESOLVED FIXED" on 2012-02-17 and
was acknowledged in comment #15. No further comments for
over 5 years so closing.

Changed in firefox (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.