As I see it, there are only two possibilities as to what is causing that. Either the program you are using or another program. For example, if you are typing in Internet Explorer, then it is possible that Internet Explorer is doing that. If you run a different brower (like Chrome) and it still does that, it is not Internet Explorer. I doubt that is the problem.
My guess is it is some other window or program. That window or program is making its window active and so what you are typing in becomes inactive. You need to look and see what else is running. Try closing all other programs and all other tabs and windows of your browser. If that solves the problem, figure out which one caused the problem. If that does not solve the problem, look in the Processes running. It has to be something there.