Magic Keyboard random input
My Magic Keyboard has an issue where it inserts random characters, or does random behaviours, when pressing a number key. If I want to insert a 2, it inputs '2`'. A 9 does '97', a 0 '08', an open bracket '(7' and a closed bracket ')8'. Weirdly when I press the number 5, it moves the cursor back one space after input. It's weird. I've tried it on a few devices. Other keyboards seem to work fine. Weirdly when I press the ` key, near the bottom of the keyboard, it inputs it as '2`'.
It's a numeric keyboard, one of the black ones from the iMac Pro release nearly a decade ago. The issue only happens when I use the top horizontal line of numbers, not the numeric keypad section. I could resolve the issue by just using that section to the right, however the issue also persists when I try to add an exclamation mark, as it comes out as '!±'.
Anyone got any suggestions of what to do to troubleshoot it, please? It's always worked fine up until now. I'm likely due an upgrade because of its age and the fact that I can update it to USB-C with the newer ones. However, I'm not just throwing away £150 for the sake of it.