I cannot fix this problem with a Mac, but here is my way around it.
This answer will help you if you are trying to use the keyboard keys behavior when the user presses CMD + S to save or something like that. This answer does not apply to people who can create a game or something where their key keyboard states should be known in every launch frame. Sorry!
In the KeyboardEvent returned by keydown, you can do the following
$(document).keydown(function(keyboardEvent) { if (keyboardEvent.metaKey){ // on Mac, CMD is down ...or Meta key is down on pc console.log(keyboardEvent.meta + " & command key are down") switch (keyboardEvent.which) { ... } } });
If your keyboard shortcut overlaps with the browser, you need to disable the keyboard event distribution,
keyboardEvent.preventDefault()
I hope this helps people who need Mac compatible keyboard functionality!
Ethan source share