What I found is that when an app becomes active, there has to be 1 main window on the same space as the current key window. However, this only happens to me when Displays Have Separate spaces is enabled while having multi monitor setup:
- Have 2 monitors A and B
- Create an app with 2 windows:
- Window 1: can become main window and key window
- Window 2: can become key window, cannot become main window
- Move Window 1 to Monitor A
- Move Window 2 to Monitor B
- Deactivate the app by going to another app (Finder or something)
- Click Window 2 on Monitor B to activate the app
- Window 2 is activated and is the key window (have highlight on the window title bar)
- Window 2 is activated
- Then immediately after that, Window 1 is activated
This produce a jarring effect where clicking on a window actually activates another window and shift the active window to that window instead.
One solution is to make Window 2 to be able to become main window, but there might be a case where you might not want that.