Jeff Atwood made a wonderful post the other day called Please Don’t Steal My Focus, and I have to say I wholeheartedly agree with him.
Of course, the question that is raised is “why are programs still doing this?” My pick for “worst offender” is, ironically, Microsoft Word. When you open Word, it forces itself as the topmost window and steals your focus. Try opening a bunch of files (say, across a slow network connection) and switch to another window and try to get some work done. You won’t be able to – because as each document opens, Word pops up as the topmost window with the focus. Thanks, Microsoft, for ignoring your own guidelines:
“The strange thing is, there are provisions built into the operating system to protect us from badly written, focus stealing applications. The ForegroundLockTimeout registry setting is expressly designed to prevent applications from stealing focus from the user. The OS silently converts that inappropriate focus stealing behavior into friendlier, less invasive taskbar button flashing, which is the subject of the ForegroundFlashCount registry setting.”
Indeed. That’s why, when I need to notify the user of something, I use a notification balloon. It’s much less intrusive and (best of all) it doesn’t steal the focus. (Plus, it looks cool.) And when you must pop up a modal dialog box and steal the user’s focus (only acceptable in response to an action the user has made in your own program of course), I make sure that there are NO default buttons and NO one-key shortcuts. That way, someone typing won’t accidentally close, cancel, or delete something just by typing. They’d have to either use the tab/arrow keys, or use an ALT+Letter combo.
Perhaps Microsoft will fix this behavior in the next version of Word, but I’m not holding my breath. As for anyone else who abuses this power… shame on you!
UPDATE: Follow-up here.