Skip to content

Commit

Permalink
Adds option to restore old behaviour. Fixes #684
Browse files Browse the repository at this point in the history
  • Loading branch information
t0xicCode committed Aug 13, 2014
1 parent bb9f9cb commit 63a0090
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions dist/js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
iconBase: 'glyphicon',
tickIcon: 'glyphicon-ok',
maxOptions: false,
mobile: false
mobile: false,
selectOnTab: false
};

Selectpicker.prototype = {
Expand Down Expand Up @@ -255,7 +256,7 @@
},

/**
* @param [updateLi]
* @param [updateLi] defaults to true
*/
render: function (updateLi) {
var that = this;
Expand Down Expand Up @@ -917,8 +918,8 @@
$items.eq(keyIndex[count - 1]).focus();
}

// Select focused option if "Enter", "Spacebar" are pressed inside the menu.
if (/(13|32)/.test(e.keyCode.toString(10)) && isActive) {
// Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu.
if ((/(13|32)/.test(e.keyCode.toString(10)) || (that.options.selectOnTab && /(^9$)/.test(e.keyCode.toString(10)))) && isActive) {
if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault();
if (!that.options.liveSearch) {
$(':focus').click();
Expand Down
Loading

1 comment on commit 63a0090

@klibansky
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! THANKS!

Please sign in to comment.