diff --git a/searx/static/themes/simple/src/js/main/keyboard.js b/searx/static/themes/simple/src/js/main/keyboard.js index 0c52673d9..09bb16214 100644 --- a/searx/static/themes/simple/src/js/main/keyboard.js +++ b/searx/static/themes/simple/src/js/main/keyboard.js @@ -32,6 +32,10 @@ searxng.ready(function () { return resultElement && resultElement.classList.contains('result-images'); } + function hasImageInDetail () { + return document.querySelector('#results.image-detail-open') !== null; + } + searxng.on('.result', 'click', function (e) { if (!isElementInDetail(e.target)) { highlightResult(this)(true, true); @@ -171,6 +175,18 @@ searxng.ready(function () { }); } + searxng.on(document, 'keydown', function (e) { + if (hasImageInDetail()) { + if (e.key === 'ArrowLeft') { + e.preventDefault(); + searxng.selectPrevious(false); + } else if (e.key === 'ArrowRight') { + e.preventDefault(); + searxng.selectNext(false); + } + } + }); + function highlightResult (which) { return function (noScroll, keepFocus) { var current = document.querySelector('.result[data-vim-selected]'),