If this is happening frequently it may be something else, but sounds a lot like this old bug that I’ve only come across randomly.
Keyboard bug GH-to-Rhino - #10 by Birk_Binnard
There’s a couple things to try but restarting Rhino is the only thing that’s worked for me.