W3C home > Mailing lists > Public > wai-xtech@w3.org > December 2007

Re: Getting the tabindex value with JavaScript on elements without a tabindex attribute

From: Simon Bates <simon.bates@utoronto.ca>
Date: Fri, 14 Dec 2007 18:38:29 -0500
Message-Id: <29F19E2D-3154-42F2-9E51-15C70AEC1CE3@utoronto.ca>
To: wai-xtech@w3.org

Updated results with Opera 9.24 on the Mac:

div with no tabindex:
	elem.getAttribute("tabindex") = null
	elem.tabIndex = undefined

input with no tabindex:
	elem.getAttribute("tabindex") = null
	elem.tabIndex = 0

I think it would be worthwhile to augment my results data with  
information about the tabbing behaviour when setting tabindex in each  
browser. I'll have a look at that next week.

Simon

On 14-Dec-07, at 4:55 PM, Simon Bates wrote:

>
> I have been writing a function for Dojo's DHTML accessibility  
> support that determines if an element is tab-navigable. The  
> function will use the extended tabindex usage defined by the  
> current ARIA and HTML5 drafts. That is, tabindex on all elements,  
> and tabindex="-1" for removal from tab order. I have discovered  
> that there is some variation across browsers in the value that one  
> gets when retrieving the tabindex value on an element without a  
> tabindex attribute. This note summaries what I have seen.
>
> I have looked at two elements: div and input. I am using div as an  
> example of an element that did not have a tabindex attribute in  
> HTML4 and input as an example of one that did. I document here two  
> mechanisms for retrieving the tabindex: getAttribute(), and the  
> tabIndex property. Please see below for a link to my test file and  
> a link to the full results.
>
> Firefox 2.0.0.11 Windows XP
> and Minefield nightly 3.0b3pre 2007121405 Windows XP
>
> div with no tabindex:
> 	elem.getAttribute("tabindex") = null
> 	elem.tabIndex = -1
>
> input with no tabindex:
> 	elem.getAttribute("tabindex") = null
> 	elem.tabIndex = 0
>
> Internet Explorer 7.0.5730.11 Windows XP
> and Internet Explorer 6 Windows XP
>
> div with no tabindex:
> 	elem.getAttribute("tabindex") = 0
> 	elem.getAttribute("tabindex", 2) = 32768
> 	elem.tabIndex = 0
>
> input with no tabindex:
> 	elem.getAttribute("tabindex") = 0
> 	elem.getAttribute("tabindex", 2) = 32768
> 	elem.tabIndex = 0
>
> On IE it is not possible to determine whether a div has no tabindex  
> or tabindex="0" using elem.getAttribute("tabindex") or  
> elem.tabIndex because a default value of 0 is returned. Microsoft  
> provides an extension to getAttribute() that can be used to  
> determine if the tabindex is unset. If a second parameter of value  
> "2" is passed to getAttribute(), a value of 32768 is returned  
> whenever tabindex is not set. See Microsoft's documentation on  
> getAttribute:
>
> http://msdn2.microsoft.com/en-us/library/ms536429.aspx
>
> I have been unable to find documentation on the value of 32768 as  
> used for tabIndex but it is outside of the range of 0 to 32767  
> specified by HTML 4:
>
> http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex
>
> Safari 3.0.4 Mac
>
> div with no tabindex:
> 	elem.getAttribute("tabindex") = null
> 	elem.tabIndex = undefined
>
> input with no tabindex:
> 	elem.getAttribute("tabindex") = null
> 	elem.tabIndex = 0
>
> Test file used to gather results:
>
> http://trac.bitstructures.com/browser/collected/trunk/html-test- 
> cases/getting-tabindex.html?format=raw
>
> Collected test results:
>
> http://trac.bitstructures.com/browser/collected/trunk/html-test- 
> cases/getting-tabindex-results.html?format=raw
>
> Please let me know if you see any shortcomings in the test file or  
> results.
>
> Simon Bates
> Adaptive Technology Resource Centre
> University of Toronto
>
>
Received on Friday, 14 December 2007 23:38:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 13:15:44 GMT