KeyboardNavigatable
The KeyboardNavigatable
class manages lists that can be navigated with the
keyboard, calling callbacks for each actions.
This helper encapsulates the key binding logic, providing a simple fluent API for use.
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
callbacks: * Callback to be executed for a specified input. |
|
public |
whenCallback: * Callback that determines whether keyboard input should be handled. |
Method Summary
Public Methods | ||
public |
Set up the navigation key bindings on the given jQuery element. |
|
public |
Interpret the given keyboard event as navigation commands. |
|
public |
Provide a callback to be executed when the navigation is canceled. |
|
public |
Provide a callback to be executed when navigating downwards. |
|
public |
Provide a callback to be executed when previous input is removed. |
|
public |
Provide a callback to be executed when the current item is selected.. |
|
public |
Provide a callback to be executed when navigating upwards. |
|
public |
Provide a callback that determines whether keyboard input should be handled. |
Public Constructors
public constructor() source
Public Members
public whenCallback: * source
Callback that determines whether keyboard input should be handled. By default, always handle keyboard navigation.
Public Methods
public bindTo($element: undefined) source
Set up the navigation key bindings on the given jQuery element.
Params:
Name | Type | Attribute | Description |
$element | undefined |
public navigate(event: undefined) source
Interpret the given keyboard event as navigation commands.
Params:
Name | Type | Attribute | Description |
event | undefined |
public onCancel(callback: undefined): * source
Provide a callback to be executed when the navigation is canceled.
This will be triggered by the Escape key.
Params:
Name | Type | Attribute | Description |
callback | undefined |
Return:
* |
public onDown(callback: undefined): * source
Provide a callback to be executed when navigating downwards.
This will be triggered by the Down key.
Params:
Name | Type | Attribute | Description |
callback | undefined |
Return:
* |
public onRemove(callback: undefined): * source
Provide a callback to be executed when previous input is removed.
This will be triggered by the Backspace key.
Params:
Name | Type | Attribute | Description |
callback | undefined |
Return:
* |
public onSelect(callback: undefined): * source
Provide a callback to be executed when the current item is selected..
This will be triggered by the Return and Tab keys..
Params:
Name | Type | Attribute | Description |
callback | undefined |
Return:
* |