Menu sometimes not functional when running app in Xcode

When running an Objective C app in Xcode 13.4 on Monterey on a 2019 MacBook Pro , app menu options sometimes only appear for as long the touchpad is pressed and the app is not responsive to menu selections. The Apple menu behaves similarly. The app can only be closed by stopping the run in Xcode. This behaviour is not reproducible - sometimes the menu appears normally.

Menu sometimes not functional when running app in Xcode
 
 
Q