greasemonkey scripts

Focus Follows Mouse: Click-Free Web-Browsing

27 March 2010

focusFollowsMouse.user.js

The script focusFollowsMouse.user.js provides a very simple implementation of "click-free" web browsing: it defines a mouseover method for every HTML link, input, select and text area which calls the focus() method on that control. (Click on the link to the script to install it as a Greasemonkey script.)

Update (17 March 2013): This script is now working again (it has been broken since January 2012). If you still have an older version installed, you should remove it using the GreaseMonkey "Manage User Scripts" dialog, restart your Firefox browser (since GreaseMonkey seems to require this), and then reinstall the new version of the script in the usual manner (i.e. by clicking on the link to the script).

Useage

This script integrates with keyboard navigation to act on links. First you use mouse motion to set the focus on a link, by hovering over it. Then you can use Firefox's built-in keyboard navigation to visit the linked page.

For example, to navigate to a link URL, do the following:

Alternatively, to open a URL in a new tab, hit Control-Enter. Other Firefox focus-related features include:

Enhancing Focus Display

By default Firefox's focus display is fairly subtle. I find it useful to set the following options via about:config:

Note: type "focus" in the filter box to see these options. Also note that clicking on the about:config link from this page doesn't actually work, presumably for security reasons, so you'll have to copy and paste the URL into the address field.

In principle it is possible to set colours in the script itself, avoiding the need to do it from about:config. However I found a couple of issues:

Issues

Safety Warning

This script is licensed under the General Public License v2.0, and as such it comes with the usual "NO WARRANTY" condition.

In particular, because the intention of the script is to enable web browsing with less unnecessary finger movements and therefore less stress to the fingers, the script necessarily causes things to happen which would not occur if the script had not been installed. In some cases this may interfere with the operation of a page, in particular if a page has complex behaviour programmed in Javascript.

It is recommended not to use this script for pages where unexpected actions may be irreversible and have costly consequences, for example online shopping (especially if it is in a state where a user-action may lead to an unexpected purchase or duplicate purchases), or online banking.

The script can be temporarily disabled my clicking on the GreaseMonkey "monkey-face" on the status bar (this will disable all installed GreaseMonkey scripts).

EXTRA Safety Warning !!!!!!!!!!!!!!!!!

If you activate Mouse-Motion-Only Navigation Mode (see below), this warning applies doubly so. Although mouse-motion-only navigation only applies to links, it's always possible that a web page might do something irreversible or damaging even when clicking on a link (this is against best practice, but like all best practices it is often ignored in practice).

So you have been warned.

Motivation

This script does not claim to provide faster navigation than clicking; to use it you have to move the mouse, then use the keyboard, then move back to the mouse, etc. However, if repetive clicking on mouse buttons specifically causes discomfort, then this script may provide relief.

Motivation for Mouse-Motion-Only Navigation Mode

Even with Focus-Follows-Mouse giving you "click-free navigation", you still have to hit keyboard keys to go places. www.dontclick.it is an example of "click-free" navigation, but that is implemented within the web site, and it requires Flash.

The Mouse-Motion-Only mode attempts to retro-fit this concept to existing websites. The current functionality is the result of various difficulties encountered while trying other schemes for mouse-motion-only navigation:

The current scheme makes it easy but not too easy to follow a link by motion only:

Despite these design decisions, there may still be situations where the combination of user mouse-motion style and browser text-wrapping behaviour when text is added to a link causes unexpected following of a link (or of the wrong link). Thus the "experimental" designation.

History

Demo

This web page loads the focusFollowsMouse.user.js directly, so you can test the functionality on the following examples even if you don't have it installed, and even if you are using a web browser other than Firefox.

Try focusing on links and form controls by moving the mouse over them. You can then submit by hitting the keyboard enter key.

Or press F9, and try the mouse-motion-only mode.

(Note: in Internet Explorer 7.0 sometimes focused links do not show a dotted border, for example if the browser window as a whole has lost and regained focus. You can reset the dotted border by pressing the Tab key to move to the next focusable element. Also, in Firefox, in this demo page, the browser does not correctly do focus and blur if you follow a link and then come back, i.e. the link followed doesn't get a blur event even though it has lost focus.)

A Form Text:

Text area:

Experimental Mouse-Motion-Only Navigation

An experimental mouse-motion-only navigation option is included in an alternative experimental version of the script at focusFollowMouseWithMouseOnlyMode.user.js (you should uninstall the standard focusFollowsMouse.user.js script first before installing this alternative script).

If you press F9, then this toggles a mode in which you can navigate by mouse motion alone (the mode starts off deactivated, and each time you toggle an alert box appears telling you the new state).

This special mode works as follows:

Note: the active/inactive status of mouse-motion-only navigation mode for this demo page is independent of the status for the Greasemonkey script (this is because the Greasemonkey script specifically disables itself for any page that loads the same script explicitly in the HTML). And it is reset to inactive every time you reload the page.

Second note: once a link is followed, the mouse-over target area becomes inactivated, and remains so, even if the user returns via the back button. Unfortunately there appears to be no event dispatched when this happens, so the only way to clear the inactivated state of the link is to focus over another link and then return to the first one.