keyDown: fires even when your app is in the background
It appears that the standard behaviour for an NSView (NSResponder in general?) is for it to “hold onto” pressed keys. That is, if a key is held down the view will keep getting keyDown: events until the key is lifted, no matter what else happens. So it can lose focus or the app loses frontmost… Read more