1

I'm working on a text editor-esque product where we're manually handling certain actions on keydown, and I've been having a hard time figuring out how to distinguish between the event.key 'Control' and/or event.code 'ControlLeft'/'ControlRight' for Mac vs Windows, which obviously do different things.

Any advice on how to handle keydown between operating systems for things like this?

Lynne Rang
  • 121
  • 1
  • 7
  • Does this answer your question? [Is there a way to detect which side the Alt key was pressed on (right or left)?](https://stackoverflow.com/questions/8562528/is-there-a-way-to-detect-which-side-the-alt-key-was-pressed-on-right-or-left) – Heretic Monkey Dec 20 '19 at 16:18
  • Thanks for the link, but I don't believe so. The issue is both keys have the same e.code and e.key and a similar location on the left. – Lynne Rang Dec 20 '19 at 18:41
  • If `e.key`, `e.code`, and `e.location` are all the same, you're likely out of luck. See [the documentation for `KeyboardEvent` for a list of all of the properties](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent). – Heretic Monkey Dec 20 '19 at 18:44

0 Answers0