I had this problem and overrode -makeKeyWindow and set a breakpoint to see how I got there:
@interface AssistedTextFieldWindow : NSWindow
@end
@implementation AssistedTextFieldWindow
-(void) makeKeyWindow
{
[super makeKeyWindow]; // break here
}
@end
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 38.1
frame #0: 0x000000010491bb90 BRP Character`-[AssistedTextFieldWindow makeKeyWindow](self=0x0000000154e22270, _cmd="makeKeyWindow") at AssistedTextField.m:19:5
frame #1: 0x00000001967aac4c AppKit`-[NSWindow _makeKeyRegardlessOfVisibility] + 56
frame #2: 0x00000001967a332c AppKit`-[NSWindow makeKeyAndOrderFront:] + 24
* frame #3: 0x000000010491c578 BRP Character`-[AssistedTextField didMakeFirstResponder:](self=0x0000000154f0e2f0, _cmd="didMakeFirstResponder:", obj=@"DidMakeFirstResponder") at AssistedTextField.m:132:29
Looking at AssistedTextField.m:132 I have:
windowController.window.isVisible = YES;
So that's how I got here. What to do about it? I have no idea.