Skip to content

Instantly share code, notes, and snippets.

@Rainyan
Last active July 18, 2023 16:15
Show Gist options
  • Save Rainyan/bdc81d2280936e26ac8690e7ac1292f9 to your computer and use it in GitHub Desktop.
Save Rainyan/bdc81d2280936e26ac8690e7ac1292f9 to your computer and use it in GitHub Desktop.
Make the GitHub web interface usable by turning off all its forced keyboard shortcuts that are interfering with browser and OS shortcuts.
// ==UserScript==
// @name Disable all GitHub shortcut keys
// @description Make the GitHub web interface usable by turning off all its forced keyboard shortcuts that are interfering with browser and OS shortcuts.
// @version 0.3.0
// @namespace githubPls
// @include https://github.com/*
// @updateURL https://gist.githubusercontent.com/Rainyan/bdc81d2280936e26ac8690e7ac1292f9/raw/
// ==/UserScript==
const ALLOWED_KEYS = [
'Backspace', // allow removing lines in web editor
'Tab', // allow indenting in web editor
];
document.addEventListener('keydown', function(e) {
if (ALLOWED_KEYS.includes(e.key)) {
return;
}
e.stopPropagation();
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment