From 84ee5d31ba134473895eac36747120d6f5078a5c Mon Sep 17 00:00:00 2001 From: Hamish Robertson Date: Tue, 25 Jul 2017 13:48:12 +0100 Subject: [PATCH] Support End and Home for navigating tab list --- src/bootstrap-tagsinput.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/bootstrap-tagsinput.js b/src/bootstrap-tagsinput.js index ac6f0e0e..648380dd 100644 --- a/src/bootstrap-tagsinput.js +++ b/src/bootstrap-tagsinput.js @@ -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 }