Get keyboard event (shortcut?) in UXP

With the old ExtendScript, we can add a script and set it’s shortcut in Photoshop.

Is it possible in UXP? I know UXP has no menu item in Photoshop, but since it’s Chromium-based, can we do something similar to:

document.onkeypress(function(e) {
    if (e.keyCode == 13) {
        foo()
    }
}

?

AFAIK with keyboard events in UXP you can only catch modifiers keys ie
e.shiftKey , e.altKey, e.metaKey

Are you talking about registering an app-wide shortcut (not currently supported), or responding to an event while the panel is focused (yes, with limitations, depending on what widget is currently focused)?

I originally wanted to set app-wide shortcut, but I’ve read the doc saying it’s impossible now. Now I just want to know what keyboard events the widget can receive.