Skip to content

Instantly share code, notes, and snippets.

@nmccready
Created September 10, 2014 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmccready/fd853479d373954138f5 to your computer and use it in GitHub Desktop.
Save nmccready/fd853479d373954138f5 to your computer and use it in GitHub Desktop.
Code fixes to make chrome keyboard tab ordering shortcuts work on OSX.
if (navigator.appVersion.indexOf("Linux") < 0) {
document.addEventListener("keydown", function(e) {
// return if no modifiers.
// if (!e.shiftKey || !e.ctrlKey) {
// return;
// }
if (!e.metaKey || !e.shiftKey) {
return;
}
// Only send if we are interested.
switch (e.keyCode) {
// Pgup/dn
case 33:
case 34:
// 0..9
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
chrome.extension.sendMessage(
{keyCode: e.keyCode},
function(response) {
// No-op.
});
e.stopPropagation();
e.preventDefault();
break;
}
},
true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment