Skip to content

Commit

Permalink
Makes the tab key function similarly to the enter key
Browse files Browse the repository at this point in the history
When filtering by typing, and pressing tab, the selected or first
choice will be selected.
  • Loading branch information
Frique committed Jul 12, 2013
1 parent 4af9c99 commit 9e85547
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jquery.minimalect.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,15 @@
break;
// enter
case 13:
// select the highlighted choice, or if there is none, select the first choice
// tab
case 9:
// select the highlighted choice
if(m.items.filter("."+m.options.class_highlighted).length)
m.selectChoice(m.items.filter("."+m.options.class_highlighted));
else
// or if there is none, select the first choice after filtering
else if(m.input.val())
m.selectChoice(m.items.not("."+m.options.class_group+", ."+m.options.class_empty).filter(':visible').first());
break;

// hide the dropdown
m.hideChoices(m.wrapper);
Expand Down

0 comments on commit 9e85547

Please sign in to comment.