If your keyboard is wireless then check the batteries. They last for months and months and its not something that needs doing often so its easy to forget that eventually they do wear out and need changing. They can give give rise to intermittent errors as they reach the end of their life. I have spent many an hour clicking around with a perfectly functional mouse trying to find the source of an intermittent keyboard problem only to discover the keyboard batteries were dying slowly.