W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > July to September 2005

Re: [TECHS] Use of anchor tags to invoke JavaScript

From: Isofarro <lists@isofarro.uklinux.net>
Date: Wed, 17 Aug 2005 19:26:39 +0100
Message-ID: <4303815F.2040905@isofarro.uklinux.net>
To: Becky_Gibson@notesdev.ibm.com
CC: w3c-wai-gl@w3.org

Becky_Gibson@notesdev.ibm.com wrote:
> 
> <andrew wrote>
> Why not:
>  <a onclick="doSomething();return false;">Action link</a>
>  
> I don't know what different user agent would do with this.  It is 
> possible that it wouldn't be in the tab order unless a tabindex was also 
> added.  Just a thought...
> </andrew>
> 
> Good idea since href is not a required attribute. But,  as you suggest, 
> the anchor is not in the tab order if there is no href.   Adding the 
> tabindex="0" attribute did not solve the problem since older browsers 
> did not include it in the tab order thus there is no keyboard focus. 


Thinking about it logically, the a element serves two purposes:
* to add a hyperlink to another document or a point inside the same document
* to be a destination for a hyperlink.

The first is accomplished using an href attribute.

The second doesn't and shouldn't by default do anything if activated. 
Its a destination, so using the name attribute gets that done. This has 
largely been superceded with the more modern id attributes on elements.

Trying to put a tabindex on an anchor with no href attribute just 
strikes me as fighting against HTML instead of working within it.



Mike
Received on Wednesday, 17 August 2005 18:27:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:47:39 GMT