Monday, December 24, 2007

Theft of Focus in Windowing Environments

I'm in the middle of composing a new message, when suddenly my cursor is no longer in the new-message window. Where are my keystrokes going? What's going on here?

You know that feeling -- some helpful application has popped up and stolen my focus.(1) It might not even be on the same display I'm looking at. It might be a program I knew was running, or something even better, like a scheduled backup or software update check.

Pay attention to me! I'm the most important program on this computer! I don't care what you were doing!

For me, the problem is a fundamental one: I can't be assured that if I close my eyes and continue typing, the right program will be receiving my keystrokes. What if another program pops up and asks if it can do something nasty, and I hit the Enter key to start a new paragraph. In that case, I just approved the nastiness. 

I want my interface with the computer to be predictable. As it is, I have to be constantly monitoring what's going on in case some helpful application decides to take over focus. In that case, I have to wrest back control, usually by saying, "no, I don't want to do that."

I had hoped, years ago, that the Mac OS X folks would somehow prevent this from happening. And some programs are nice about it. For example, iCal doesn't steal focus when it pops up a reminder. Adium doesn't steal focus when a new chat window opens because someone else sent me an instant message. But Apple Mail will steal focus if something happens that it doesn't like. As will Apple Backup when it inexplicably asks for permission to do something I already scheduled it to do! Microsoft Office Update (a pox I brought on myself, I guess) will gladly pop up and take over as well.

I don't mind new windows popping up, but it seems like there should be some basic rules:
  1. A new window shouldn't change my focus. My keystrokes should continue to go to the same program they were going to before.
  2. A new window shouldn't cover the currently-focused window. Put it somewhere else -- a different display, or even behind the focused window if necessary. Just don't obscure what I'm doing.




(1) I'm not even sure that's what non-X11 folks call it. In X11, the "focus" was the currently-active window. Stealing focus is when another program pops up and takes over.

No comments: