forked from Ponysearch/Ponysearch
[fix] keyboard navigation / simple theme (UI)
- avoid loop select - fix select next item in mixed result lists Replaces: https://github.com/searxng/searxng/pull/2789 Closes: https://github.com/searxng/searxng/issues/2751 Closes: https://github.com/searxng/searxng/issues/2788
This commit is contained in:
parent
ec540a967a
commit
92d0c378e0
2 changed files with 5 additions and 9 deletions
|
@ -169,3 +169,4 @@ features or generally made searx better:
|
|||
- @llmII
|
||||
- @blob42 `<https://blob42.xyz>`_
|
||||
- Paolo Basso `<https://github.com/paolobasso99>`
|
||||
- Bernie Huang `<https://github.com/BernieHuang2008>`
|
|
@ -213,6 +213,7 @@ searxng.ready(function () {
|
|||
}
|
||||
|
||||
var next, results = document.querySelectorAll('.result');
|
||||
results = Array.from(results); // convert NodeList to Array for further use
|
||||
|
||||
if (typeof effectiveWhich !== 'string') {
|
||||
next = effectiveWhich;
|
||||
|
@ -233,16 +234,10 @@ searxng.ready(function () {
|
|||
}
|
||||
break;
|
||||
case 'down':
|
||||
next = current.nextElementSibling;
|
||||
if (next === null) {
|
||||
next = results[0];
|
||||
}
|
||||
next = results[results.indexOf(current) + 1] || current;
|
||||
break;
|
||||
case 'up':
|
||||
next = current.previousElementSibling;
|
||||
if (next === null) {
|
||||
next = results[results.length - 1];
|
||||
}
|
||||
next = results[results.indexOf(current) - 1] || current;
|
||||
break;
|
||||
case 'bottom':
|
||||
next = results[results.length - 1];
|
||||
|
|
Loading…
Reference in a new issue