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:
parent
e9ef2accdf
commit
8c258fd96c
2 changed files with 49 additions and 3 deletions
|
@ -74,6 +74,10 @@
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.searchHint:focus {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
.searchHintImage {
|
.searchHintImage {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 15%;
|
width: 15%;
|
||||||
|
|
|
@ -246,12 +246,54 @@
|
||||||
return false;
|
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) {
|
$('#txtSearch', parentElem).on("keyup", function (e) {
|
||||||
|
|
||||||
var value = this.value;
|
// Down
|
||||||
|
if (e.keyCode == 40) {
|
||||||
|
|
||||||
showFlyout(parentElem);
|
var first = $('.searchHint', parentElem)[0];
|
||||||
updateFlyout(parentElem, value);
|
|
||||||
|
if (first) {
|
||||||
|
first.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}).on("keyup", function (e) {
|
||||||
|
|
||||||
|
if (e.keyCode != 40) {
|
||||||
|
var value = this.value;
|
||||||
|
|
||||||
|
showFlyout(parentElem);
|
||||||
|
updateFlyout(parentElem, value);
|
||||||
|
}
|
||||||
|
|
||||||
}).on("focus", function () {
|
}).on("focus", function () {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue