Added Tab and Shift+Tab support to autocomplete

This commit is contained in:
Marcin Kurczewski 2015-05-22 22:44:25 +02:00
parent 4ba855871f
commit 38bfbfb8f3

View file

@ -6,6 +6,7 @@ App.Controls.AutoCompleteInput = function($input) {
var jQuery = App.DI.get('jQuery'); var jQuery = App.DI.get('jQuery');
var tagList = App.DI.get('tagList'); var tagList = App.DI.get('tagList');
var KEY_TAB = 9;
var KEY_RETURN = 13; var KEY_RETURN = 13;
var KEY_DELETE = 46; var KEY_DELETE = 46;
var KEY_ESCAPE = 27; var KEY_ESCAPE = 27;
@ -68,6 +69,12 @@ App.Controls.AutoCompleteInput = function($input) {
var func = null; var func = null;
if (isShown() && e.which === KEY_ESCAPE) { if (isShown() && e.which === KEY_ESCAPE) {
func = hide; func = hide;
} else if (isShown() && e.which === KEY_TAB) {
if (e.shiftKey) {
func = selectPrevious;
} else {
func = selectNext;
}
} else if (isShown() && e.which === KEY_DOWN) { } else if (isShown() && e.which === KEY_DOWN) {
func = selectNext; func = selectNext;
} else if (isShown() && e.which === KEY_UP) { } else if (isShown() && e.which === KEY_UP) {