Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tabStop

In the need to mess with the focus of elements this plugin gives you the next or previous 'focusable' element according to the [HTML5 Standard Draft] [1].

Call `$.tabStop( direction )` where `direction` may be a negative value to receive the previous element, else the next element is given.
Call `$.tabStop( direction, focusables )` where `direction` may be a negative value to receive the previous element, else the next element is given, and `focusables` is an optional string, by default `focusables = 'a[href],link[href],button,input:not([type="hidden"]),select,textarea,menuitem,[draggable="true"]'`.
If the jQuery object on which this method is called is empty the next (or previous) element after the active element is returned.
If the first element of the jQuery object is not focusable itself the first focusable element in the document is returned.
The order of elements is handled as circle, as next element after the last focusable element you will receive the first and the other way around.
Expand Down
4 changes: 2 additions & 2 deletions jquery.tabstop.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Please, feel free to upgrade the selectors to eradicate this blemish!
*/

(function ( $ ) {
$.fn.tabStop = function( direction ) {
$.fn.tabStop = function( direction, optInFocusable ) {
// elements focusable by tabindex attribute
var activeTabindex = '[tabindex]:not([tabindex^="-"])',
// elements that are focusable
optInFocusable = 'a[href],link[href],button,input:not([type="hidden"]),select,textarea,menuitem,[draggable="true"]',
optInFocusable = optInFocusable || 'a[href],link[href],button,input:not([type="hidden"]),select,textarea,menuitem,[draggable="true"]',
// excluding criteria (or already in selection)
optOutFocusable = '[tabindex],[disabled]',
focusable = $(activeTabindex).get().sort(function(a,b) {
Expand Down
2 changes: 1 addition & 1 deletion jquery.tabstop.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.