Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Support End and Home for navigating tab list
Browse files Browse the repository at this point in the history
  • Loading branch information
hrobertson committed Jul 25, 2017
1 parent 3b13674 commit 84ee5d3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/bootstrap-tagsinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,22 @@
$input.focus();
}
break;
case 'Home':
// Try to move the input before the first tag
var $firstTag = $inputWrapper.siblings().first();
if ($input.val().length === 0 && $firstTag[0]) {
$firstTag.before($inputWrapper);
$input.focus();
}
break;
case 'End':
// Try to move the input after the last tag
var $lastTag = $inputWrapper.siblings().last();
if ($input.val().length === 0 && $lastTag[0]) {
$lastTag.after($inputWrapper);
$input.focus();
}
break;
default:
// ignore
}
Expand Down

0 comments on commit 84ee5d3

Please sign in to comment.