1

Is there a tool that will allow me to prevent specific pages from refocusing my keyboard when I load them?

1

I had the same problem.

Background: when Google searching, I often visit a lot of pages in the results for 3 or 4 seconds and then want to go back. Unfortunately, backspace doesn't navigate the page because a search box is focussed. Moving the trackpad up to the back button so many times is tedious on a smaller laptop.

Page Navigation Solution: Simply hitting the Tab key before Backspace leaves the box and causes backspace to navigate away from the page. Alt+LeftArrow also works on Windows systems.

.

Actual Userscript Solution: Pulled from here: Superuser post

// ==UserScript==
// @name           Disable auto-focussing
// @author         ComFreek <comfreek at the following domain 'outlook' with the TLD 'com'>
// @description    Disable auto-focussing
// @include *
// @version        1.0
// ==/UserScript==

var maxTime = 3000;
var timeoutInterval = 5;

var usedTime = 0;
var isManualFocus = false;
function check() {
    if (!isManualFocus && document.activeElement.tagName.toLowerCase() == "input") {
        console.log("BLURRED");
        document.activeElement.blur();
    }
    usedTime += timeoutInterval;
    if (usedTime < maxTime) {
        window.setTimeout(check, timeoutInterval);
    }
}
check();


document.body.addEventListener("click", function (evt) {
    if (evt.target.tagName == "INPUT") {
        console.log("MANUAL CLICK");
        isManualFocus = true;
    }
});

document.body.addEventListener("keydown", function (evt) {
    isManualFocus = true;
});

All credit goes to Comfreek

I hope this helps!

4
  • 1
    {Alt}-{left arrow}? Feb 6 '16 at 8:30
  • I didn't know about that one! Thanks! Let me know how the userscript goes, if it doesn't work I can try to whip up some code for a Chrome extension.. Feb 6 '16 at 9:21
  • Also consider {CTRL}+L. Feb 6 '16 at 19:57
  • Would it be possible to tailor this script to focus the address bar, in order to discern our article from the others? Feb 6 '16 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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