Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Commit

Permalink
TAB now selects the currently highlighted item.
Browse files Browse the repository at this point in the history
  • Loading branch information
jstayton committed Sep 4, 2012
1 parent acc23da commit 7d7bcd9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/jquery.marcopolo.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
ENTER: 13,
ESC: 27,
HOME: 36,
TAB: 9,
UP: 38
},

Expand Down Expand Up @@ -547,7 +548,7 @@

break;

// Select the currently highlighted item.
// Select the currently highlighted item. Input keeps focus.
case self.keys.ENTER:
// Prevent selection if the list isn't visible.
if (!$list.is(':visible')) {
Expand All @@ -573,6 +574,21 @@

break;

// Select the currently highlighted item. Input loses focus.
case self.keys.TAB:
// Prevent selection if the list isn't visible.
if (!$list.is(':visible')) {
return;
}

$highlighted = self._highlighted();

if ($highlighted.length) {
self.select($highlighted.data('marcoPolo'), $highlighted);
}

break;

// Hide the list.
case self.keys.ESC:
self
Expand Down

0 comments on commit 7d7bcd9

Please sign in to comment.