Earlier quoted context omitted.
This reminds me of one of my personal bugaboos, which seems especially bad in Microsoft Windows: windows that spawn child windows that require input focus, but that don’t grab focus leaving you typing into nothing at all! Truly its crazy making.
IMHO, a worse practice is when you are happily typing along and the system throws up a dialog randomly, grabbing the focus and thereby "pressing" one of the buttons when you thought you were typing. Who knows what you just agreed to.
Generally if you were interacting with the computer then whatever new thing should get focus iff its appearance was a direct result of your current interaction.