Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

One primary requirement lacking in jQuery (and in most DHTML toolkits in general) at the moment is robust support for keyboard accessibility. To this end, Fluid is developing a couple of jQuery plugins plugin that will make it significantly easier to create DHTML interfaces that support familiar idioms for navigating with the keyboard.

The

...

Plugin

jQuery.keyboard-a11y

  • Makes it easier inject keyboard accessibility into your DHTML interfaces, without having to write onerous hand-rolled code for managing focus and tabbing behaviour.
  • Provides cross-browser support and normalization for getting, setting, and evaluating the presence of the "tabindex" attribute.
  • Still in development.
  • More information about browser incompatibilities can be found in Simon Bates' recent Fluid blog post

This plugin makes it easy for developers to add keyboard handlers to their code without a lot of extra overhead. A common problem in the DHTML world is that user interfaces are built to work solely with the mouse, excluding users who need to use the keyboard to navigate. jquery.tabindex will take the hard work out of making your interfaces usable with the tab and arrow keys.

...

download jQuery.keyboard-a11y

Keyboard A11y API

Code Block

jQuery().tabindex()

Gets the tabindex value of the first matched element. If the element doesn't have a tabindex attribute, undefined is returned. The value returned is normalized to a Number, since browser implementations vary.

Code Block
jQuery().tabindex(value)

Sets the tabindex value on all matched elements. value can be either a String or a Number, but valid tabindex attributes need to be integers.

Code Block

jQuery().removeTabindex()

Removes the tabindex attribute from all matched elements.

Code Block

jQuery().hasTabindexAttr()

Returns true if the element has a tabindex attribute, and returns false if tabindex is not set. Neither Simon or I have yet to come up with a reliable method for querying tabindex attributes on versions of IE < 6, so this method will always return false on IE 5.5 and below.

Code Block

jQuery().hasTabindex()

Returns true if the element has a tabindex attribute, or is an HTML element that is included in the tab order by default (i.e. a, input, button, select, area, textarea, or object).

Code Block

jQuery().tabbable()

Adds all matched elements to the tab order by giving them a tabindex attribute of "0."

...

Activates the specified item using the default activation handler.

jQuery.tabIndex

  • Provides cross-browser support and normalization for getting, setting, and evaluating the presence of the "tabindex" attribute.
  • More information about browser incompatibilities can be found in Simon Bates' recent Fluid blog post

download jQuery.tabIndex plugin

TabIndex API

Code Block

jQuery().tabindex()

Gets the tabindex value of the first matched element. If the element doesn't have a tabindex attribute, undefined is returned. The value returned is normalized to a Number, since browser implementations vary.

Code Block

jQuery().tabindex(value)

Sets the tabindex value on all matched elements. value can be either a String or a Number, but valid tabindex attributes need to be integers.

Code Block

jQuery().removeTabindex()

Removes the tabindex attribute from all matched elements.

Code Block

jQuery().hasTabindex()

Returns true if the element has a tabindex attribute, and returns false if tabindex is not set. Neither Simon or I have yet to come up with a reliable method for querying tabindex attributes on versions of IE < 6, so this method will always return false on IE 5.5 and below.