summaryrefslogtreecommitdiff
path: root/searx/static
diff options
context:
space:
mode:
Diffstat (limited to 'searx/static')
-rw-r--r--searx/static/themes/simple/src/js/main/keyboard.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/searx/static/themes/simple/src/js/main/keyboard.js b/searx/static/themes/simple/src/js/main/keyboard.js
index 4a6f9d384..5c02acbfd 100644
--- a/searx/static/themes/simple/src/js/main/keyboard.js
+++ b/searx/static/themes/simple/src/js/main/keyboard.js
@@ -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];