Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
    
What page are you on for T? – Eight Days of Malaise Oct 29 '13 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 Oct 30 '13 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 Jul 4 '14 at 9:23
    
    
@TomWoodward thx, looks like it will work everywhere – janot Feb 12 at 4:22
up vote 1 down vote accepted

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;
});
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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