1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

added keyboard nav for search hints

This commit is contained in:
Luke Pulverenti 2013-05-21 17:13:57 -04:00
parent e9ef2accdf
commit 8c258fd96c
2 changed files with 49 additions and 3 deletions

View file

@ -246,12 +246,54 @@
return false;
});
$('#searchHints', parentElem).on("keydown", '.searchHint', function (e) {
// Down
if (e.keyCode == 40) {
var next = $(this).next()[0];
if (next) {
next.focus();
}
}
// Up
if (e.keyCode == 38) {
var prev = $(this).prev()[0];
if (prev) {
prev.focus();
} else {
$('#txtSearch', parentElem)[0].focus();
}
}
});
$('#txtSearch', parentElem).on("keyup", function (e) {
var value = this.value;
// Down
if (e.keyCode == 40) {
showFlyout(parentElem);
updateFlyout(parentElem, value);
var first = $('.searchHint', parentElem)[0];
if (first) {
first.focus();
}
}
}).on("keyup", function (e) {
if (e.keyCode != 40) {
var value = this.value;
showFlyout(parentElem);
updateFlyout(parentElem, value);
}
}).on("focus", function () {