Colin,

>Recently I've been working on a plugin for jQuery that will make adding
>keyboard accessibility to your user interfaces a lot easier. In the process
>of working on this, I ran into a number of inconsistencies in the way that
>browsers handle the tabindex attribute. Getting, setting, and checking for
>the presence of tabindex is a pretty common task for handling keyboard
>accessibility, so I decided to roll this into a little plugin for jQuery.
>
>I've documented the plugin on my blog, but here's a quick summary of how to
>use it:
>
>jQuery().tabindex() // Returns the tabindex value of the first matched
>element, or undefined if no tabindex has been set.
>jQuery().tabindex(value) // Sets the tabindex value all matched elements.
>This will take either a String or a Number, but valid tabindex values
>should be -1, 0, or a positive integer.
>jQuery().removeTabindex() // Removes the tabindex attribute altogether from
>all matched elements.
>jQuery().hasTabindex() // Returns true if the first matched element has a
>tabindex value, false if not.
>
>More details available at:
>
>http://fluidproject.org/blog/2008/01/11/jquery-tabindex-plugin/

It looks like there's a little bit of cross over between what you're doing
and tabIndex functions I have in the Field plug-in:

http://jquery.com/plugins/project/field

There are some key differences, as my methods are geared to navigate between
form fields only. However, perhaps you might find some code in the Field
plug-in that you might find useful.

The methods you'd be interested in are:

$("#formName").autoAdvance();*
The autoAdvance() will search through the matching elements in the selector
for any text-based input fields. It will then apply an onkeyup event that
will take the user to the next field in the tabIndex (within the context of
the form) when the maxlength value of the field has been reached.

$("[EMAIL PROTECTED]'users']").moveNext();*
This would move the focus to the next field in the tabIndex array from the
"users" field. If the next tabItem is outside of the form's context, the
first element in the form will be selected.

$("[EMAIL PROTECTED]'users']").movePrev();*
This would move the focus to the previous field in the tabIndex array from
the "users" field. If the previous tabItem is outside of the form's context,
the last element in the form will be selected.

$("[EMAIL PROTECTED]'users']").moveIndex(3);*
This would move the focus to the third element in the tabIndex array. If the
value "3" is outside the tabIndex array for the current form, then the last
field would be selected.

$("[EMAIL PROTECTED]'users']").getTabIndex();*
This returns the tabIndex for the current field as it relates to the parent
form object.

-Dan

Reply via email to