Selected application loses focus Since upgrading to Yosemite, the current application -- could be anything from Sublime Text to AppCode to Chrome -- will lose focus while I'm typing.

This happens with an external keyboard or an internal keyboard, with the computer lid closed (MBP Retina) and open.

Any advice or event hints?
The issue was due to a dockbar application grabbing the focus occasionally. One such culprit: older versions of Google Drive, as seen here: https://productforums.google.com/forum/#!msg/drive/epLdP4Bny5w/gKQsxwDMoUAJ

However, any application can grab and keep focus. 

Note: for me the problem was a very outdated version of Google Drive.