It could be a keyboard issue so the test is well known. Try an USB KEYBOARD. If that works you see how much a new laptop keyboard is.

If not I look for malware or the old ACCESSIBILITY settings. No OS noted so I can't be more detailed. Also does it do it when you reload the OS?