An open API service indexing awesome lists of open source software.

https://github.com/joelpurra/skipontab

A jQuery plugin to exempt selected form fields from the forward tab order.
https://github.com/joelpurra/skipontab

efficiency html html-forms javascript jquery jquery-plugin skipped-fields speedup tabindex user-experience ux

Last synced: about 2 months ago
JSON representation

A jQuery plugin to exempt selected form fields from the forward tab order.

Awesome Lists containing this project

README

          

# [SkipOnTab](https://joelpurra.com/projects/skipontab/) javascript library

- A [jQuery](https://jquery.com/) 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.

- [Project page](https://joelpurra.com/projects/skipontab/)
- [Source code on Github](https://github.com/joelpurra/skipontab)
- [Basic demo](https://joelpurra.com/projects/skipontab/docs/example/demo.html)
- [Order form demo](https://joelpurra.com/projects/skipontab/docs/example/skip-some-fields-in-order-form.html)
- [Test suite](https://joelpurra.com/projects/skipontab/docs/test/)

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.

## Get it

- Directly: [`src/skipontab.joelpurra.js`](src/skipontab.joelpurra.js)
- [Bower](https://bower.io/):

```
bower install jquery-skipontab
```

## Demos

- [`example/demo.html`](https://joelpurra.com/projects/skipontab/docs/example/demo.html): Simple demo for playing around.
- [`example/skip-some-fields-in-order-form.html`](https://joelpurra.com/projects/skipontab/docs/example/skip-some-fields-in-order-form.html): Expanded demo with some thoughts on what fields to skip.

## Usage

### HTML

```html

Joel Purra


  1. Checkbox

  2. Another checkbox

  3. Important checkbox

  4. Another important checkbox


```

### Javascript

```javascript
// 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);
```

### Skippable elements

Elements that can be focused/tabbed include ``, ``, ``, `` and `` (the `href` attribute must exist and the tag must have some contents). These are also the elements that can be skipped.

Note that ``, `` (without `href` or empty contents), `disabled="disabled"` or `display: none;` elements cannot be focused.

### Static elements

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

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.

### Containers

When SkipOnTab is applied to html containers, like `

`, `
    ` or ``, all skippable child elements are implicitly skipped. This applies to static html and subsequently added child elements.

    ### Disabling skipping

    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.

    ## Original purpose

    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 versus tabindex](https://github.com/joelpurra/skipontab/wiki/SkipOnTab-versus-tabindex)

    SkipOnTab does *not* rely on setting [`tabindex`](https://www.w3.org/TR/html4/interact/forms.html#h-17.11.1) on elements - it uses javascript events instead. Read more on the wiki page [SkipOnTab versus tabindex](https://github.com/joelpurra/skipontab/wiki/SkipOnTab-versus-tabindex).

    ## Dependencies

    SkipOnTab's runtime dependencies are

    - [jQuery](https://jquery.com/)
    - [EmulateTab](https://github.com/joelpurra/emulatetab), one of SkipOnTab's sister projects.

    ## Browser compatibility

    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](https://joelpurra.com/projects/skipontab/docs/test/) and then report any issues.

    ## Todo

    - Break out reusable key press functions from tests.
    - Investigate how usable `data-skip-on-tab="#id-of-next-element-in-the-order"` would be.

    ## See also

    PlusAsTab's sister projects.

    - [PlusAsTab](https://github.com/joelpurra/plusastab) - use the + key on the *keypad* as a tab key equivalent for faster numeric input.
    - [EmulateTab](https://github.com/joelpurra/emulatetab) - the tab emulator used by both SkipOnTab and PlusAsTab.

    ---

    [SkipOnTab](https://joelpurra.com/projects/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](https://joelpurra.com/). [Your donations are appreciated!](https://joelpurra.com/donate/)