I'm especially interested in disabling "T" button.
-
What page are you on for T?– Eight Days of MalaiseCommented Oct 29, 2013 at 20:22
-
@EightDaysofMalaise At least on every "repository" page. For example here: github.com/qbittorrent/qBittorrent . I haven't noticed before, it's shortcut for "file finder"– janotCommented Oct 30, 2013 at 10:30
-
I use search-as-you-type to find things in my editors and on github pages, it's really annoying when it jumps me off the page i'm on and onto the "find a file" screen because i pressed 't'.– ConanCommented Jul 4, 2014 at 9:23
-
In Firefox it looks like this'll work.– Tom WoodwardCommented Feb 12, 2016 at 3:18
-
@TomWoodward thx, looks like it will work everywhere– janotCommented Feb 12, 2016 at 4:22
4 Answers
Basically copying answer from superuser.com linked by Tom Woodward in comments. I've only changed keycode and url.
It's Greasemonkey script which disables "T" shortcut. Supported by major browsers (extension like Greasemonkey for Firefox/Tampermonkey for Chrome may be needed/useful).
// Your code here...
// ==UserScript==
// @name Disable keyboard shortcuts
// @description Stop websites from highjacking keyboard shortcuts
//
// @run-at document-start
// @include *github.com*
// @grant none
// ==/UserScript==
keycodes = [84] // Keycode for 'T', add more keycodes to disable other key captures
document.addEventListener('keydown', function(e) {
// alert(e.keyCode); //uncomment to find out the keycode for any given key
if (keycodes.indexOf(e.keyCode) != -1)
{
e.cancelBubble = true;
e.stopImmediatePropagation();
}
return false;
});
-
This answer is outdated, there is now an easier way to do this through GitHub Accessibility settings, I've added a new answer.– FJCCommented Jul 28, 2023 at 10:17
To simplify janot's answer (I can't add comments) use e.key
instead of e.keyCode
, then you don't need to figure out keycodes at all and instead can just list your keys = ['t']
.
You can disable keyboard shortcuts that don't use a modifier key (Ctrl
or Cmd
) in the GitHub Accessibility settings
-
I thought this answer was a totally different approach to the accepted answer so would not be suitable to edit it. Can you link me to where the forum policy states link-only answers are bad?– FJCCommented Aug 14, 2023 at 8:53
-
edit "your" answer, not the accepted answer. See How to Answer: "Links to other websites should always be helpful, but avoid making it necessary to click on them as much as possible.". This Meta Stack Exchange post also has some related content– Blindspots ♦Commented Aug 14, 2023 at 14:54
-
SE sites are not forums. Even as an experienced SE user, if you never have, it would be valuable on each site to take the Tour and review How to Ask and How to Answer. While I expect the "link only" issue is pretty common, other guidelines will vary. You are automatically given 100 reputation when you join new sites based on your SE "experience". In turn you should be familiar with how the sites work, and willing to access readily available documentation like How to Answer.– Blindspots ♦Commented Aug 14, 2023 at 15:06
The shortcut feature related code is in this JavaScript file:
https://github.githubassets.com/assets/environment-bootstrap-63ce95f0.js
You can use a browser ad block extension and disable this URL:
https://github.githubassets.com/assets/environment-bootstrap*
This will completely disable the shortcut feature.