by f33d5173 · 5mo ago · 0 comments
There should be a proposal for browsers to expose a property on the keydown/up/press event containing a code for the key combination. Something like "CTRL+S", "CTRL+ALT+S", etc. The programmer could then switch over this property rather than having to check key codes and modifiers manually.
I would also propose to any web developers that they build this property themselves in their own code and check against it instead of checking modifiers directly. Not only would it protect against bugs like in the OP, it would also be a lot more convenient to use.
Imagine the damage programmers could do if they had more options to meddle easily! They have low-level APIs if they need them to hook keys. Best leave it at that.
Meanwhile, there is the accesskey attribute in HTML to let you customise shortcut keys: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...
Holy crow what a mess. No wonder I'd never heard of this.