I've solved the issue with a workaround (until I understand what is causing the initial issue).
I mimic clicking in windowA by sending a mouseDownEvent, and it works.
self.window?.makeFirstResponder(self.window)
self.theViewToClick.perform(#selector(NSResponder.self.mouseDown(with:)), with: newMouseDownEvent!)
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: