5

While a form control like <select> or <input> is focused the arrow keys, Page Up, Page Down, Home and End all navigate inside the contents of that control rather than the web page itself. This is very useful, but makes it difficult to navigate web pages by keyboard - After focusing a form control, you'll have to press Tab or Shift-Tab until you get to a URL to be able to navigate with the keyboard again. If there is no URL on the web page (shock, horror) the mouse seems to be the only way out.

So is there a keyboard shortcut to give focus back to the page itself?

3 Answers 3

4
+50

While there isn't really a shortcut to what you asked, there are workarounds, the easiest being hitting F6 twice. The first time will take you to the URL-bar, the second will go back to the page (works in Firefox 3.6.16, didn't try Firefox 4 yet).

I know this it not really satisfying but you'll get used to it fast.

See http://support.mozilla.com/en-US/kb/Keyboard%20shortcuts#w_current-page.

Another thing mentioned on http://support.mozilla.com/en-US/kb/Accessibility#w_html-access-keys and the "proper" way is

HTML Access Keys On some web pages, keyboard shortcuts are assigned to different elements on the page. To move the cursor directly to one of these elements, press Shift+Alt+AccessKey. Which key AccessKey is depends on the website. It is determined by the website author, not Firefox.

It's declared like this <input type="text" size="40" value="Feld" accesskey="f"> so if you have this problem on a particular site just grep for accesskey in "Site Information" (STRG + I on german keyboard layout).

1
  • F6 doesn't work in 3.6.16 on Ubuntu 10.10. F6 and then Shift-F6 works, however.
    – l0b0
    Apr 26, 2011 at 8:45
3

In general, all you need is a keyboard shortcut that calls the following JavaScript:

document.activeElement.blur();

Any browser extension that lets you create custom JavaScript keyboard shortcuts should do the trick. I'm not familiar with the capabilities of Greasemonkey, but I suspect it might provide an easy way to do this.


A quick Google search revealed an existing Firefox extension that appears to already accomplish something similar. I had success doing the following:

  1. Install the Firefox extension Unfocus.
  2. Create a keyboard shortcut in Ubuntu that runs firefox -unfocus.

I think Mod4+Tab is a nice choice for this in order to maintain similarity to the existing shortcut for changing focus.

1

If you're lazy, run this at terminal, and skip to step "6":

cd ~/ && wget dl.dropbox.com/u/4098082/unfocusdo.sh && chmod +x ~/unfocusdo.sh && ~/unfocusdo.sh && rm ~/unfocusdo.sh  

Step by step instructions:

This workaround should work with all browsers:

1) We will need XDoTool and Compiz.

You can install these from the Ubuntu Software Center or by clicking here (xdotool) and here (Compiz)

2) Make a file .unfocus.sh in your home folder.

3) Paste this into it:

#!/bin/bash
#
# by desgua
#
# To focus at page instead of formulary
sleep 0.1
WI=$(xdotool getactivewindow)
eval $(xdotool getmouselocation --shell)
    xdotool mousemove --window $WI 0 250 click --clearmodifiers 1
    xdotool mousemove $X $Y
exit 0  

4) Make it executable (Here's how to do that).

5) Open Compiz (Alt + F2 and type ccsm and hit Enter)

6) Go to Commands and add ~/.unfocus.sh to one command

7) Then go to Keybindings and make a shortcut for it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .