forked from zaclys/searxng
[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
38966b1bbe
commit
3bd3aa325e
|
@ -168,4 +168,5 @@ features or generally made searx better:
|
||||||
- Milad Laly @Milad-Laly
|
- Milad Laly @Milad-Laly
|
||||||
- @llmII
|
- @llmII
|
||||||
- @blob42 `<https://blob42.xyz>`_
|
- @blob42 `<https://blob42.xyz>`_
|
||||||
- Paolo Basso `<https://github.com/paolobasso99>`
|
- 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');
|
var next, results = document.querySelectorAll('.result');
|
||||||
|
results = Array.from(results); // convert NodeList to Array for further use
|
||||||
|
|
||||||
if (typeof effectiveWhich !== 'string') {
|
if (typeof effectiveWhich !== 'string') {
|
||||||
next = effectiveWhich;
|
next = effectiveWhich;
|
||||||
|
@ -233,16 +234,10 @@ searxng.ready(function () {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'down':
|
case 'down':
|
||||||
next = current.nextElementSibling;
|
next = results[results.indexOf(current) + 1] || current;
|
||||||
if (next === null) {
|
|
||||||
next = results[0];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'up':
|
case 'up':
|
||||||
next = current.previousElementSibling;
|
next = results[results.indexOf(current) - 1] || current;
|
||||||
if (next === null) {
|
|
||||||
next = results[results.length - 1];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
next = results[results.length - 1];
|
next = results[results.length - 1];
|
||||||
|
|
Loading…
Reference in New Issue