You could borrow another wired keyboard first (doesn't need to be Mac) to check whether that's the problem. And someone's giving away a couple of Mac keyboards a couple of pages back.
I'ts the keyboard unfortunately. Tested with my wife's imac keyboard and it works. rip 2011 wireless keyboard. - I have message the person to see if there still available.
You could borrow another wired keyboard first (doesn't need to be Mac) to check whether that's the problem. And someone's giving away a couple of Mac keyboards a couple of pages back.