Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Firefox, certain websites and certain plugins appear to "capture" the "control" key, so that when I try to open a new tab using Ctrl+t, nothing happens - or worse, something unexpected happens.

Examples:

  • On the Codecademy site, while editing code, Ctrl+t either does nothing, or switches the position of the two characters next to the cursor.
  • When viewing PDF's with the Adobe PDF plugin, Ctrl+t does nothing.

Is there a way to disable this "feature"? I would like Ctrl+t to always "talk" to Firefox!

Edit: I found that my question is very similar to the following questions:

The answers to these questions are interesting and relevant, but do not give a method on how to disable combinations such as "Ctrl+t". Maybe a modified Greasemonkey script is the easiest solultion.

Edit 2 - A partial solution The following Userscript (edit: now an answer) was mostly copy/pasted from StackExchange. To use it, you need to install GreaseMonkey. The script successfully captures Ctrl+t on some sites, for example Google (-> PopUp "Gotcha" appears), but not on the Codecademy site.

Also, I found another question pertaining to this subject: "How to forbid keyboard shortcut stealing by websites in Firefox". It was raised in 2010, and the consensus was: It can't be done.

Edit 3 - Made the userscript work I edited the userscript so that it now successfully prevents javascripts from intercepting Ctrl+t, and thanks to JC2k8 I also found a workaround for plugins (which I have not tested yet). I combined the information and submitted an answer - I'll wait a few days and accept the answer with the highest votes.

share|improve this question
    
If you think that's annoying, then Ctrl+Tab in this situation probably makes you go bananas like it does for me lol. This also happens on video sites like DailyMotion.com if the video player is focused. Also, Google Chrome doesn't seem to suffer from this symptom as often –  MonkeyZeus Nov 4 '13 at 20:36
    
Ugh, madness. It's a design fail of Firefox, Websites, and OS's in general. It's 2013 and there is still no consensus as to what shortcuts should do what. Maybe you can try modifying the Greasemonkey script (the tab-keycode is 9). You might be in luck and it works on your favourite websites. –  Martin J.H. Nov 4 '13 at 21:15

3 Answers 3

up vote 1 down vote accepted

For plugins intercepting keystrokes: Thanks to JC2k8's answer, I came across this link where someone wrote a patch to intercept "important" keystrokes before they are send to plugin processes. It's pretty new and it is still in evaluation, but it's nice to see that someone is working on it. I have not tested it, but it might solve the problem.

For javascript intercepting keystrokes: I finally managed to get my userscript working by combining this script and this script. I have to admit I'm not quite sure how the eventListener has to be attached and why it did not work earlier (see older versions of my question if you are interested). Anyway, the following script works at least on Firefox 17 ESR.

// ==UserScript==
// @name           Disable Ctrl T interceptions
// @description    Stop websites from highjacking keyboard shortcuts
//
// @run-at         document-start
// @include        *
// @grant          none
// ==/UserScript==

// Keycode for 't'. Add more to disable other ctrl+X interceptions
keycodes = [84];  

(window.opera ? document.body : document).addEventListener('keydown', function(e) {
    // alert(e.keyCode ); //uncomment to find more keyCodes
    if (keycodes.indexOf(e.keyCode) != -1 && e.ctrlKey) {
        e.cancelBubble = true;
        e.stopImmediatePropagation();
    // alert("Gotcha!"); //ucomment to check if it's seeing the combo
    }
    return false;
}, !window.opera);
share|improve this answer

As soon as plugins (Flash, Acrobat Reader, Quicktime, …) are involved you're out of luck. Mozilla has always wanted to fix this bug by "fixing" the plugin API to allow plugins to send back "unused" keys but due to the scale of this work it has never been done. For a lengthy debate on this issue you can take a look at Bug 78414 at Bugzilla.

share|improve this answer
    
Thanks for the link! It lead me to another site, where a workaround happens to be evaluated right now: fossfactory.org/project/p81 –  Martin J.H. Nov 5 '13 at 9:33

You could capture the Ctrl-T key sequence at the OS level, and pass it through to firefox.

For example you could use AutoHotKey to listen for Ctrl-T and issue the command

"C:\Program Files\Mozilla Firefox\firefox.exe" -new-tab about:newtab

Replace about:newtab with an actual web page URL if you prefer. This opens a new tab in the existing instance of firefox. You should be able to trap the sequence only when ff has focus, but still capture it before javascript gets it.

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.