

Please Don't Steal My Focus - german
http://www.codinghorror.com/blog/archives/001011.html

======
spolsky
The problem is more complicated than it seems. Apps have to be allowed to take
focus otherwise a newly-launched app wouldn't have keyboard focus. You'd click
on a link in your email and the web browser would come up but then you'd have
to move the keyboard focus to the browser yourself.

Usually these bugs are caused by someone fixing another bug. It seems even
wronger when a dialog box or some other new window comes up, and the focus is
not on it. This gets reported, and the programmer fixes the problem by taking
focus.

~~~
bk
How about this:

_User_ triggered apps/windows/dialogs are allowed to take focus, because it's
clearly the user's intention to open/use that app. This does not hold true for
automatic updater windows, such as update boxes, new chat messages, etc.

OS X for example gets this half right, with the play sound and bounce dock
icon features. The perpetually bouncing icons can drive me crazy, so the best
solution would be if cmd-tab automatically put apps demanding user attention
first in the open apps list, so that as soon as there's a dock bounce, I can
get to it with one quick cmd-tab. That way I can get to it fast and I don't
run the risk of the spacebar-ok|cancel disaster (which in minor forms has
happened to me before too).

------
tx
Yeah... And nearly everybody (as always) complain about "stupid windows
_unable to stop_ apps from stealing focus". Actually this stuff is
configurable, there isn't a standard UI for it, but little freeware "Tweak UI"
tool lets you do just that, see the screenshot:
<http://kontsevoy.com/tweakui.gif>

~~~
oconnor0
Wow, thanks. That's sweet. The Windows XP link is about halfway down this
page:

[http://www.microsoft.com/windowsxp/downloads/powertoys/xppow...](http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx)

------
qaexl
On the other hand, on Linux I use a terminal called tilda. The newer window
managers have focus stealing prevention. It prevents tilda from stealing the
focus like it should. Focus stealing prevention has interrupted me _far_ more
often than focus stealing ever had.

"Apps should never steal focus" is a pretty broad generalization that's not
always right. Then again, most Linux apps do not randomly pop up dialogs
trying to alert you of something.

------
bayareaguy
OSX apps don't always get this right.

Happened to my wife yesterday - she was trying to use the BART website to
print herself a one-day parking pass. She was using an OSX 10.4 powerbook with
Firefox and choose Save As PDF. Unfortunately something went wrong with
Firefox at that moment and another modal dialog appeared.

This dialog unfortunately obscured the first one but for some reason did not
have the focus. She freaked out because now she couldn't safely quit the
application and she was afraid that she wouldn't be able to get back to the
site without having to pay again.

Luckily the number for her parking pass was visible on the screen so she
recorded that and called the help line.

I don't think this is a browser issue, and I think the only solution is to
insist that all modal dialogs implement the ESC key as Cancel. The vi editor
got this right 30 years ago: you should always be allowed to press ESC to get
out of whatever mode you're in.

~~~
earthboundkid
The problem is that Firefox on Mac is a second class citizen, and it uses
modal dialog boxes.

As for the Esc thing, I can't recall a case where a Mac native application
didn't press "Cancel" when I hit escape. I think there might be problems with
ported applications though.

------
JeffL
What I dislike is when I launch a program like Photoshop, which initially
opens up it's window, but it then has to hit the disk for about 10 seconds or
so before it can really load, so of course, as soon as I launch it, I alt-tab
away to a browser window or something else, but then when Photoshop or
whatever else it was that I launched finishes loading, it steals focus back
from me. It should wait quietly until I'm ready for it, or better yet, when
you run a program, it should load whatever it needs to load into memory before
opening up its window at all and then when it's ready to give me a usable
application, then open up.

------
rontr
When I moved from reddit to hacker news, I was hoping Coding Horror wouldn't
follow.

