This is basically impossible, because the key matrix -> letter translation can be done in multiple places (in the keyboard firmware, in the OS, etc.). Hilariously, sometimes your keyboard firmware has to be aware of the OS translation; you cannot send a & keypress event over USB, so you have to send "shift + 7" if you want a key that generates that input. Because of all this, application developers have to add a "key binding preferences" page to their application. There is absolutely no way they can target a certain physical location on your keyboard.
None of this is specific to Javascript, of course. This is all about protocols and the OS.
As someone who just is getting into custom keyboards, this is one really ugly wart in the whole stack. imho ideally keyboard would just send individual scancodes and the host would manage all the key layout stuff. But making fully custom layouts complete with custom modifiers is afaik pretty much impossible with Windows/Mac/mobiles, and even on Linux its bit of a pain. So it ends up easier for keyboard to pretend to be a standard keyboard and have macros to send complex scancode sequences and then just have standard US qwerty layout on host side. Which kinda works until you want to input stuff that is not on the standard US layout at which point you need some different layout on the host, and then you need to remap the keyboard so that it is in sync with the layout. And then you need to sync these configurations across different computers and operating systems.
Sometimes standardization is great, but sometimes it hides all sorts of pitfalls that you'll stumble upon once you actually want to step outside the standard solutions.
There is no 1:1 keyboard position -> letter mapping, nor is there a 1:1 letter -> keyboard position mapping. This means something like "detect a press and hold of whatever key results in the input 'w'" is impossible. You can detect an "input" event for it, but there is no guarantee that there will be a "keydown" or "keyup" event. Similarly, you can't have something like "show the label on the key which is normally labelled 'w' on a Qwerty keyboard". It is not guaranteed to have a character associated with it.
Technically nothing is stopping you from creating shortcuts, but you are going to have an awfully hard time creating them in a way which works for all users.
The web is far too hostile of a place to allow exposure of a robust API to it.