diff options
| author | Paul Braeuning <paul@paulgo.io> | 2022-06-14 19:07:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-14 19:07:09 +0200 |
| commit | d7a76f37724d6bef167f450d330a6277c851f580 (patch) | |
| tree | 3034d4a9722924a472ce3cc5e86826c0b71aa9e5 /searx/static/themes/simple/src | |
| parent | e67ed894472002681ecec813688586666faebbde (diff) | |
| parent | 1a361e6635a36e8fb1397407e351409bc64495f9 (diff) | |
Merge pull request #1322 from return42/fix-794
[fix] keyboard.js - highlightResult: don't steal focus on click event
Diffstat (limited to 'searx/static/themes/simple/src')
| -rw-r--r-- | searx/static/themes/simple/src/js/main/keyboard.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/searx/static/themes/simple/src/js/main/keyboard.js b/searx/static/themes/simple/src/js/main/keyboard.js index 0eb30b09f..0c52673d9 100644 --- a/searx/static/themes/simple/src/js/main/keyboard.js +++ b/searx/static/themes/simple/src/js/main/keyboard.js @@ -34,7 +34,7 @@ searxng.ready(function () { searxng.on('.result', 'click', function (e) { if (!isElementInDetail(e.target)) { - highlightResult(this)(true); + highlightResult(this)(true, true); let resultElement = getResultElement(e.target); if (isImageResult(resultElement)) { e.preventDefault(); @@ -172,7 +172,7 @@ searxng.ready(function () { } function highlightResult (which) { - return function (noScroll) { + return function (noScroll, keepFocus) { var current = document.querySelector('.result[data-vim-selected]'), effectiveWhich = which; if (current === null) { @@ -233,9 +233,11 @@ searxng.ready(function () { if (next) { current.removeAttribute('data-vim-selected'); next.setAttribute('data-vim-selected', 'true'); - var link = next.querySelector('h3 a') || next.querySelector('a'); - if (link !== null) { - link.focus(); + if (!keepFocus) { + var link = next.querySelector('h3 a') || next.querySelector('a'); + if (link !== null) { + link.focus(); + } } if (!noScroll) { scrollPageToSelected(); |