diff options
author | Jinyuan Huang <88757735+BernieHuang2008@users.noreply.github.com> | 2023-09-16 09:53:59 +0000 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-09-16 13:45:43 +0200 |
commit | 92d0c378e01e277e87b13537bc6942994b320d2d (patch) | |
tree | 2008f1dd78d17214cf5b8ce66059a46db21c1701 /searx/static/themes/simple/src | |
parent | ec540a967a66156baa06797183cc64c4a3e345be (diff) | |
download | searxng-92d0c378e01e277e87b13537bc6942994b320d2d.tar.gz searxng-92d0c378e01e277e87b13537bc6942994b320d2d.zip |
[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
Diffstat (limited to 'searx/static/themes/simple/src')
-rw-r--r-- | searx/static/themes/simple/src/js/main/keyboard.js | 11 |
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]; |