- A jQuery plugin to
- exempt selected fields from the forward tab order.
- include excluded fields in the reverse tab order.
⚠️ This project has been archived
No future updates are planned. Feel free to continue using it, but expect no support.
When using tab to navigate through a form, skipping some fields will reduce key presses for the normal use cases. Skipped fields can still be navigated to by keyboard; once skipped and focusing the next form field, use shift-tab to step back. Mouse or touch navigation is unaffected.
This library is most useful when the users are familiar with the form, and uses it regularly. Casual users may not feel as comfortable - then again, if they are already using the tab button, they might see it as an optimization.
bower install jquery-skipontab
example/demo.html: Simple demo for playing around.
example/skip-some-fields-in-order-form.html: Expanded demo with some thoughts on what fields to skip.
<!-- Can be applied to skippable elements one by one --> <input type="text" data-skip-on-tab="true" /> <textarea data-skip-on-tab="true"></textarea> <a href="https://joelpurra.com/" data-skip-on-tab="true">Joel Purra</a> <input type="button" value="This button is not skipped" /> <!-- Can be applied using a class name --> <input type="text" value="" class="skip-on-tab" /> <!-- Can be applied to all skippable elements within a container --> <ol data-skip-on-tab="true"> <li><input type="checkbox" /> Checkbox</li> <li><input type="checkbox" /> Another checkbox</li> <!-- Can be explicitly exluded from skipping --> <li><input type="checkbox" data-skip-on-tab="false" /> Important checkbox</li> <li><input type="checkbox" class="disable-skip-on-tab" /> Another important checkbox</li> </ol>
// Apply skip on tab to the selected elements/containers $(selector).skipOnTab(); // Exclude skip on tab to the selected elements/containers $(selector).skipOnTab(false); // Equivalent static function JoelPurra.SkipOnTab.skipOnTab($(selector)); JoelPurra.SkipOnTab.skipOnTab($(selector), false);
Elements that can be focused/tabbed include
<a href="..."> (the
href attribute must exist and the tag must have some contents). These are also the elements that can be skipped.
<input type="hidden" />,
href or empty contents),
display: none; elements cannot be focused.
Static skippable html elements can have, or be contained within elements that have, the attribute
data-skip-on-tab="true" or the class
.skip-on-tab. They are enabled automatically when the library has been loaded/executed.
Dynamic elements are initialized to SkipOnTab in code after adding them to the DOM;
$("#my-optional-input").skipOnTab(). This is not necessary if the added element already is contained within an element that is marked for skipping. You can also call
.skipOnTab() on containers.
When SkipOnTab is applied to html containers, like
<fieldset>, all skippable child elements are implicitly skipped. This applies to static html and subsequently added child elements.
Skippable elements, or containers with skippable children, marked with class
.disable-skip-on-tab or attribute
data-skip-on-tab="false" are never skipped. Disabling can also be done dynamically on elements/containers with
$(selector).skipOnTab(false). If skipping is disabled for the element when it receives focus, or any of its elements parents, it will not be skipped. Disabling skipping takes precedence over enabling skipping.
Developed to skip less used form fields in a web application for registering and administering letters. Examples of skipped fields are dropdowns with sensible defaults, the second address line fields in address forms and buttons for seldom used actions.
SkipOnTab’s runtime dependencies are
Should be about as compatible as jQuery is, since most functions depend on jQuery’s normalization. You are engouraged to run the SkipOnTab test suite and then report any issues.
- Break out reusable key press functions from tests.
- Investigate how usable
PlusAsTab’s sister projects.
- PlusAsTab - use the + key on the keypad as a tab key equivalent for faster numeric input.
- EmulateTab - the tab emulator used by both SkipOnTab and PlusAsTab.
SkipOnTab copyright © 2011, 2012, 2013, 2014, 2015, 2016, 2017, The Swedish Post and Telecom Authority (PTS). All rights reserved. Released under the BSD license. Developed for PTS by Joel Purra. Your donations are appreciated!