blog’s amazing Rotating Header Image

Opera and iGoogle: do you want your Tab key back?

In case you’re using Google Search with your Google account logged in you may have already seen the iGoogle features like Promote, Remove or Comment.

They may be cool in some cases, however, these icons break the keyboard navigation on a Google result page: they just steal your Tab key, which is the fastest way of quickly changing keyboard focus back to the query field. The feature used hundreds times a day.

Fortunately to tame the beast only a few lines of user JS is enough, like this:

// site: google.com
// user javascript use the tab key to focus to search field
// created by: dotsamazing.com (blog.dotsamazing.com)

if ( location.hostname.indexOf('google.com') != -1 ) {

  if( location.href.match(/search/) )

    document.onkeypress = function(e) {

      keynum  = e.which;

      if ( keynum == 9 ) {

        if (
             ( e.srcElement.name == 'q' ) &&
             ( e.srcElement.tagName == 'INPUT' )
           )
          // may still press tab key to move
          // on to Search submit button
          return true;
        else {
          // in any other case focus to search field
          document.forms[0].q.focus();
          return false;
        }

      }

    }

}

Just place these lines in a file named googletabkey.js under user_javascripts in your Opera profile directory (something like Documents and Settings/youruser/Application Data/Opera/Opera/profile/user_javascripts, YMMV), and now you’re ready to go!

From now on when you’re opening the search pages at google.com, your Tab key will only move between the top search field and its submit button.

Bookmark and Share

Leave a Reply