Windows itself isn't guilty of this in my experience (lifetime of use until Linux switch last year), but other apps like shitty Akamai. Some years ago a coworker wrote this blog post and a simple tool to find out which programs are doing it: https://forwardscattering.org/post/30
Windows is absolutely guilty of this, and it is trivial to reproduce.
Reproduction steps:
- Start a reply to this comment in your browser, type some example words.
- Create a BAT file with the following contents:
This occurs commonly and continuously on Windows, it is damn obnoxious. The OS should never ever change focus, it should however flash the window/taskbar, that is acceptable, but not shift my typing into whatever arbitrary program opened. This used to be fixable via "ForegroundLockTimeout" which is what classic TweakUI altered, but was killed in Vista.If you're a Visual Studio user, it is a daily annoyance. You hit Start/Play, go about your work, and then suddenly some time later focus shifts out from under you.
I'm running Windows (25H2, 26200.7462). I used the batch file you pasted and tried your repro steps, multiple times (I started writing this comment, in fact). It didn't steal focus. (Edit: See below). I'm quite sure that I haven't had a steal-focus issue at the OS level for many years, and I use Windows all day, every day. I'm also a Visual Studio user.
Edit: I tried it with Firefox and got a repro there. No stealing with Edge.