Dorward

Removing the focus marker from clicked upon links

13 January 2006

Nathan Smith describes a technique for removing the focus marker from around links in FireFox. Unfortunately it has some issues…

The focus indicator is there for a reason, by removing it you make it many times more difficult to use a website with a non-pointing device (e.g. keyboard tabbing through links).

There are lots of people out there who won't, or can't, use a mouse. For instance, switching to the keyboard can provide relief from RSI.

If you are going to remove the standard indicator that tells people where the focus is, then please put something else (that is obvious) in its place.

Another option is to forget the myth that image replacement techniques are accessible. Screen readers are not the start and end of accessibility. A glance at Mike Rundle's article with images turned off shows a noticeable lack of content as the text has still been moved out of the way.

Of course, having written this I then notice that Mary has already pointed it out.

I couldn't get her suggestion to work with onmousedown, but it worked with onmouse up. Calling the following function will set it up for every link on the page (although it might interfere with existing event handlers, I haven't tested it that far yet).


function zapFocus() {
    if (document.getElementsByTagName) {
        var an = document.getElementsByTagName('a');
        for (i=0; i<an.length; i++) {
            var evn = "this.blur()";
            var fun = new Function('e',evn);
            an.item(i).onmouseup = fun;
	}
    }
} 

I'm not entirely sure that removing the visual clue after a link has been clicked is a great idea, but its certainly better then removing the focus indicator entirely.

Note to self: read things carefully before commenting on them.

The article also includes some code that, in theory removes the focus indicator only when mouse activated by using the :active pseudoclass. Unfortunately it doesn't appear to entirely work.

:active applies when a link is being activated, such as when it is being clicked on. This means that when the mouse is released the focus indicator comes back, something especially noticeable when the link is to a site which doesn't respond very quickly.