Cannot cmd-click or option-click code in Xcode and other applications with non-Apple keyboard
I finally found the solution to the problem. Basically when using the external keyboard, I installed a tool called CKB which helps with re-mapping keys. I originally believed this was required. However, from macOS Sierra and above this remapping of modifier keys like Ctrl,Cmd and Shift is now available in the System Preferences under Keyboard &gt; Modifier Keys.

So the solution was to uninstall CKB reboot and set the custom mapping in the System Preferences

For more info I've included the link where I found the answer: https://github.com/ccMSC/ckb/issues/473