We heard numerous reports of focus issues last year but not hearing as many now as then. 3rd party apps are notorious about stealing focus. Have you tried a clean boot to eliminate any software conflict. If the problem doesn't happen in clean boot, one of your applications is causing the problem.
This tutorial will show you how to perform a clean boot to start Windows 10 or Windows 11 using a minimal set of drivers and startup programs for troubleshooting application conflicts. Troubleshooting Windows can be a complex process due to the many different drivers, settings, and programs...
www.elevenforum.com
You might also do an advanced forum search for "apps lose focus" or "windows lose focus"you will find tons of suggestions.
Also, it would help if you would fill out your system specs in your forum profile.