So… what is the right way to capture all of the keyboard input on a page? E.g., for the purpose of implementing shortcut keys. I managed to google some weird old workarounds, none of which work anymore, therefore I am interested to understand, what is the preferred way to do that?
My intuitive guess is of course something like this:
Template.body.events({
'keyup'(event) {
event.preventDefault();
console.log(event.originalEvent.key);
},
});
It ends up triggering on inputs, buttons, spans and checkboxes only (looks like these are focusable controls or something), but how about the whole page? E.g., with no control focused? Click event gets caught everywhere, so I’d expect the same for keyboard as well.
Thanks in advance!