document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.code === "KeyA") {
console.log("Shortcut pressed!")
}
})
I qualify the above as easy.
> "Users don't want websites to override their keyboard shortcuts" is so right and so telling!
I mean, it's no different from an OS that has shortcuts that applications shouldn't override. The browser is just one more system layer. That may limit some of the specific shortcuts you may want to use (or not! you can override them if you deem that worthwhile to your users), but it doesn't make things "hard". At my company we solved this by adding Shift to every binding, which browsers hardly ever use.
And again, if you're using Electron, you don't even have to worry about that aspect because your user isn't exposed to the UI "as a website", meaning they won't be reloading, going back/forward, opening new tabs, etc which are the most common browser-level keybindings.