18

I'm especially interested in disabling "T" button.

5
  • What page are you on for T? Commented 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"
    – janot
    Commented 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'.
    – Conan
    Commented Jul 4, 2014 at 9:23
  • In Firefox it looks like this'll work. Commented Feb 12, 2016 at 3:18
  • @TomWoodward thx, looks like it will work everywhere
    – janot
    Commented Feb 12, 2016 at 4:22

4 Answers 4

2

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;
});
1
  • This answer is outdated, there is now an easier way to do this through GitHub Accessibility settings, I've added a new answer.
    – FJC
    Commented Jul 28, 2023 at 10:17
1

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'].

1

You can disable keyboard shortcuts that don't use a modifier key (Ctrl or Cmd) in the GitHub Accessibility settings

3
  • 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?
    – FJC
    Commented 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
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.