How to use keyboard to navigate google search results (now that instant search is dead)

58

27

As of today, Google Instant Search is dead. This is what it used to look like:

https://www.youtube.com/watch?v=ANVT56wlmTo

I never cared much for the instant display of results while I typed. However, I did use, hundreds of times a day, the keyboard shortcuts it allowed.

For those that never used it - with instant search turned on, you could:

  • Press enter after a search, and use the up/down keys to move a 'pointer' down through the results

  • Then press 'enter' to open a search result being pointed at

  • At any point in time, typing letters/numbers on the keyboard would refocus on the search bar

  • Pressing enter with a result highlighted could be combined with the ctrl modifier to open a result in a new tab.

I find the mouse quite difficult to use and try to avoid it when possible. Is there a tool or script I could use to replicate the keyboard behaviour that instant search used to give me?

Previous questions have asked (and been answered) in the era of instant search (e.g. this, this and my previous question here), while I'm looking for a non-google replacement with the same functionality.

I am using Chrome on Ubuntu 15.01.

Bill Cheatham

Posted 2017-07-26T19:02:50.570

Reputation: 1 139

Question was closed 2017-08-05T03:58:25.400

2

You remember correctly, it used to work fine. It seems it has gone away along with the instant search. http://searchengineland.com/google-dropped-google-instant-search-279674 . But are you sure the instant search is still working for you, though? For me, it doesn't do a search before I press enter any more. (I like that behaviour, but I want the little blue arrow back, like you do.)

– Bloke – 2017-07-26T15:11:28.037

1this is extremely disappointing .... it seems the hotkey to use '/' to return to the search bar has also gone away with instant search – itzjustricky – 2017-07-26T15:54:37.097

3In the same position as you. It's bizarre the most popular web page on the planet has messed up this simple UX design. I'm sure a greasemonkey/tampermonkey script could work but not the most desired solution. – Kable – 2017-07-27T07:54:22.443

You can still navigate the search results using the Tab key. – Seth – 2017-07-27T10:30:54.927

@Seth - I don't think I'm able to do that. What sequence of keystrokes do you use to make this work? If I type into the search box on google.com, then press enter then tab, the focus shifts to a button to the right but it doesn't allow me to open a search result unless I press tab 17 times. Is that the use of tab you mean? – Bill Cheatham – 2017-07-27T10:48:53.873

Yes, it's not attractive but one of the options to navigate the site using a keyboard. – Seth – 2017-07-27T11:50:08.810

Oh dear - so it is official! +1 to Bill for sourcing this article. I was hoping this was a bug that might go away... :-( – Robino – 2017-07-27T13:42:48.667

Actually, Bill. I think you should close this question because it's too similar to this one: https://superuser.com/questions/509192/tab-enter-no-longer-taking-me-to-first-google-search-result-in-chrome

– Robino – 2017-07-27T13:54:17.717

2https://chrome.google.com/webstore/detail/keyboard-shortcuts-for-go/naaaebidllcopodoaeeedjnbibinnpid/related?hl=en&gl=US This one works perfectly out of the box for me! Chrome only obvi. – Thalassophobia – 2017-07-28T02:47:10.197

On that same topic, is there any option available for Firefox? – hazerd – 2017-07-30T12:17:08.610

@hazerd You may try Vimperator. The equivalent for Chrome would be cVim

– xji – 2017-08-01T11:18:38.627

1DuckDuckGo has this by default and (!) respects your privacy. – Michael S. – 2017-08-01T11:22:36.313

This answer worked perfectly for me: https://superuser.com/a/1235114/99219

– qwertzguy – 2017-08-22T23:18:37.260

Answers

25

Google have removed this feature (called Google Instant Prediction), so you can't just turn it out like you used to be able to.

I was so sad to see this feature go that I wrote a hack to re-engineer it last night. So far it only works with Google Chrome, but can be adapted to work with all the others:

  1. Install Chrome extension ShortKeys.
  2. Click on the ShortKeys menu and select "Options" enter image description here
  3. Click on "Add" and fill in the following fields:

Keyboard Shortcut: tab

Behavior: Run JavaScript

Label as: Result Picker

  1. Paste the following JavaScript into the JavaScript code to run:

    document.selectedResultId=0
    function selectResult(newId){
        els = document.querySelectorAll("div.r h3")
        if(newId < 0 || newId >= els.length)
            return  //Could modify for page nav...?
        rp = document.getElementById("result-pointer")
        if(rp != null){
            rp.remove()
        }
        document.selectedResultId=newId
        el = els[newId]
        lnk = el.firstElementChild
        el.innerHTML = "<div id=\"result-pointer\" style=\"position:absolute;left:-15px;\">&gt;</div>" + el.innerHTML
        lnk.focus()
    }
    document.onkeyup=function(event){
        if(event.keyCode==38)
            selectResult(document.selectedResultId-1)
        if(event.keyCode==40)
            selectResult(document.selectedResultId+1)
        if(event.keyCode==13){
          var el = document.querySelectorAll("div.r h3")[document.selectedResultId]
          var lnk = el.parentElement
          var url = lnk.href
          if(event.ctrlKey){
            var win = window.open(url,"_blank")
            win.blur()
            window.open().close()
          }
          else{
            document.location = url
          }
        }
    }
    selectResult(0)
    
  2. Configure the Activation Settings:

Active while in form fields (Checked)

Websites (Only specific sites)

URLS (one per line): *.google.*

This is what the Options page should look like

ShortKeys Options Page

  1. Click Save and then close your browser.

Instructions:

  • When you restart you should see a little blue ">" appear by search results when you hit tab.

  • The up/down arrow keys make it cycle through the results.

  • Hitting "Enter" will navigate to the highlighted result.

  • Hitting "Ctrl+Enter" to open the result in a new tab.

Happy Searching!

Robino

Posted 2017-07-26T19:02:50.570

Reputation: 758

14

I've created a Chrome extension that will add back the primary keyboard functionality (that I used at least). If the search box isn't focused, pressing any key will automatically focus it. In addition, arrow keys and tab/shift+tab will let you navigate between results. Hopefully this can help us remain productive until Google (hopefully) adds the functionality back.

https://chrome.google.com/webstore/detail/google-search-result-keyb/iobmefdldoplhmonnnkchglfdeepnfhd?hl=en&gl=US

Here's the code for the extension in case you want to edit it:

(function() {
  'use strict';

  var isResultsPage = document.querySelector('html[itemtype="http://schema.org/SearchResultsPage"]');
  if (!isResultsPage) {
    return;
  }

  var searchbox = document.querySelector('form[role="search"] input[type="text"]:nth-of-type(1)'),
      results = document.querySelectorAll('h3 a'),
      KEY_UP = 38,
      KEY_DOWN = 40,
      KEY_TAB = 9;

  function focusResult(offset) {
    var focused = document.querySelector('h3 a:focus');

    // No result is currently focused. Focus the first one
    if (focused == null) {
      results[0].focus();
    }
    else {
      for (var i = 0; i < results.length; i++) {
        var result = results[i];
        if (result === focused) {
          var focusIndex = i + offset;
          if (focusIndex < 0) focusIndex = 0;
          if (focusIndex >= results.length) focusIndex = results.length - 1;
          results[focusIndex].focus();
        }
      }
    }
  }

  window.addEventListener('keydown', function(e) {
    e = e || window.event;

    var isSearchActive = searchbox === document.activeElement,
        keycode = e.keyCode,
        // From https://stackoverflow.com/questions/12467240/determine-if-javascript-e-keycode-is-a-printable-non-control-character
        isPrintable = (keycode > 47 && keycode < 58)   || // number keys
                      (keycode > 64 && keycode < 91)   || // letter keys
                      (keycode > 95 && keycode < 112)  || // numpad keys
                      (keycode > 185 && keycode < 193) || // ;=,-./` (in order)
                      (keycode > 218 && keycode < 223);   // [\]' (in order)

    if ((!isSearchActive && e.keyCode == KEY_DOWN) || (e.keyCode == KEY_TAB && !e.shiftKey)) {
      e.preventDefault();
      e.stopPropagation();
      focusResult(1); // Focus next
    }
    else if ((!isSearchActive && e.keyCode == KEY_UP) || (e.keyCode == KEY_TAB && e.shiftKey)) {
      e.preventDefault();
      e.stopPropagation();
      focusResult(-1); // Focus previous
    }
    else if (!isSearchActive && isPrintable) {
      // Otherwise, force caret to end of text and focus the search box
      searchbox.value = searchbox.value + " ";
      searchbox.focus();
    }
  });
})();

Jacob Chafik

Posted 2017-07-26T19:02:50.570

Reputation: 141

The author released the source code of his extension here. It is slightly more advanced than the code snippet above.

– pcworld – 2017-09-10T13:51:25.003

This extension works great, use it almost ever day. – swerly – 2018-10-24T03:48:10.230

almost perfect, what I don't like is it indents forward the current highlighted search result – relG – 2019-11-16T13:36:28.163

I realized this can be configured - if you remove the arrow and "add styling" it's 99.9% optimal. Really nice extension! – relG – 2019-11-16T17:48:44.363

12

As of 2017-07-31, Google removed this feature entirely from search.

I created the open source Web Search Navigator extension to fix this and add extra features (like configurable keyboard shortcuts).

See installation instructions.

Hope you find it useful, but in any case - feedback is welcome!

infokiller

Posted 2017-07-26T19:02:50.570

Reputation: 301

2This is brilliant! More people should be aware of it. – SlavaSt – 2018-01-07T19:34:22.263

The Chrome-link is 404 now – Rheven – 2018-09-27T07:35:22.527

@Rheven see updated answer – infokiller – 2018-10-01T10:54:38.343

5

For firefox I solve this issue by Google Search Result Keyboard Shortcuts add-on. https://addons.mozilla.org/en-US/firefox/addon/google-search-result-shortcuts/?src=api

valior

Posted 2017-07-26T19:02:50.570

Reputation: 51

1

You may try extensions that introduce Vim-like keybindings. With them you'll never need to use your mouse again. For example, cVim is the one that's currently most powerful for Chrome, while Vimperator is the one for Firefox.

With such extensions you can access any link on the current page by pressing f (by default) followed by a one/two key combination.

xji

Posted 2017-07-26T19:02:50.570

Reputation: 656