UK keyboard layout \ and ` swapped even with ISO keyboard and British PC layout
Normally to get and \ the right way round for a British keyboard you need to change the keyboard layout to
British - PC`, and you need to convince MacOS that you have an ISO keyboard, rather than an ANSI one. This is described in this closely related but not duplicate question. The solutions there have worked for me in the past (see my answer to that question).
However, I just got a new Mac, and I am now running it through a Thunderbolt 3 dock and a KVM switch, and that seems to have confused it somewhat.
When I run the keyboard type identifier it says they keyboard type cannot be identified:
If I click "Skip" it defaults to JIS - I definitely don't have a Japanese keyboard!
If I select ISO then the problem remains - @ and " are the right way round, but \ and ` are not.
How can I fix this? Note that I do have Karabiner-Elements installed, but unlike in previous versions there are no options to change the virtual keyboard type in it.
Ok, so I re-read my previous answer and noticed that I needed to restart my computer when I wrote that. So I tried it, and it worked! The keyboard identification wizard appears on login but this time it had no problem identifying my keyboard as ISO.
If you have keyboard layout issue in MacOS try restarting your computer!