Keyboard Accessibility Plugin API - v0.5
options:
Name | Description | Values | Default |
|---|---|---|---|
selectableElements | The set of nodes (a JQuery) which are to form the selectable set (these should all be nested within the DOM element representing the "container") | jQuery | empty |
selectableSelector | A selector which will be used to locate the | string | ".selectable" |
onSelect | A function to be invoked when an element is selected | function | empty |
onUnselect | A function to invoked when an element is unselected | function | empty |
onLeaveContainer | A function to be invoked when focus leaves the container | function | empty |
| Indicates the orientation of the selectable elements. This value will be used to determine the appropriate mapping for next and previous. | | |
| Indicates whether or not focus should be moved to the first child of the container (or to the last selected child, depending on | boolean | |
| Indicates whether or not to keep track of which child element was most recently selected. | boolean | |
*
jQuery().activatable(customHandler, options)
*
Makes all matched elements activatable with the Spacebar and Enter keys. A handler function may be provided to trigger custom behaviour.
Arguments:
Name | Description |
|---|---|
| A function that will be called when the element is activated. The function should accept the element to be activated as a parameter: |
| An optional collection of name-value pairs that allow you to active elements using other keystrokes (see below). |
options:
Name | Description | Values | Default |
|---|---|---|---|
| An array of keycodes to use for activation. |
| |
*
jQuery().selectNext();
jQuery().selectPrevious();
jQuery().select(elementToSelect);
*
Selects the next, previous, or specified element in the list of selectables (invoked on the jQuery for the container element)
*
jQuery().currentSelection();
*
Gets the currently selected element (invoked on the container element)
*
var selectableContext = jQuery().getSelectableContext();
*
Returns the "that" bound to the container, which exposes further fine-grained operations on the component.
*
selectableContext.refresh();
*
Where the context was initialised with selectableSelector and not a raw selectableElements, refreshes the list of selectables that the container is managing by reevaluating the selector (to take account of any DOM modifications in the meantime).
*
jQuery().activate(elementToActivate);
*
Activates the specified item using the default activation handler. Note that if the user has provided a handler function to activatable(), that is the handler that will be used.