Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow keyboard control: add tabIndex option. #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ defaults = {
, disabledOpacity : 0.5
, speed : '0.4s'
, size : 'default'
, tabIndex : ''
};
```

Expand All @@ -89,6 +90,7 @@ defaults = {
- `disabledOpacity` : opacity of the switch when it's disabled (0 to 1)
- `speed` : length of time that the transition will take, ex. '0.4s', '1s', '2.2s' (Note: transition speed of the handle is twice shorter)
- `size` : size of the switch element (small or large)
- `tabIndex` : tab order of an element

## API

Expand Down
2 changes: 2 additions & 0 deletions dist/switchery.js
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,7 @@ var defaults = {
, disabledOpacity : 0.5
, speed : '0.4s'
, size : 'default'
, tabIndex : ''
};

/**
Expand Down Expand Up @@ -1661,6 +1662,7 @@ Switchery.prototype.create = function() {
this.jack = document.createElement('small');
this.switcher.appendChild(this.jack);
this.switcher.className = this.options.className;
this.switcher.tabIndex = this.options.tabIndex;
this.events = events(this.switcher, this);

return this.switcher;
Expand Down
Loading