Losing keyboard focus OS X

When using text input in a plugin on OS X, the editor won’t really lose focus when clicking somewhere else inside the DAW. Text can’t be entered any more but the editor won’t close its edit mode. It seems as if keyboard focus is lost without notifying the editing component.
When clicking on another window or the desktop, focus is lost as expected. I tested this in Logic X and Reaper on OS X 10.10.5 with the latest tip’s JuceDemoPlugin.

I don’t think this depends much on the host and I’m not even sure whether this isn’t an OS X problem (or feature). Any idea whether this could be improved?

We are seeing this behavior as well: focus is lost (keyboard input is no longer possible), but focusLost is never actually called when clicking somewhere else in the DAW.

Was this ever improved / fixed?

Bump. Sorry if this seems like an insignificant issue, but our plugins actively display the keyboard focus to the user, so it’s really obvious when it’s wrong.

Following up on this.

Looks like this issue is worse that expected: if two juce plugin windows are open (testing in Logic X), it’s possible to enter a state where the keyboard focus does not match the selected window, and text can still be entered in the non-selected window.

Any help would be much appreciated.

I’m no Cocoa expert, but it seems that adding observers for NSWindowDidResignKeyNotification and NSWindowDidBecomeKeyNotification allows us to properly catch the focus change.