mirror of https://github.com/searxng/searxng.git
Merge pull request #1322 from return42/fix-794
[fix] keyboard.js - highlightResult: don't steal focus on click event
This commit is contained in:
commit
d7a76f3772
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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,10 +233,12 @@ searxng.ready(function () {
|
|||
if (next) {
|
||||
current.removeAttribute('data-vim-selected');
|
||||
next.setAttribute('data-vim-selected', 'true');
|
||||
if (!keepFocus) {
|
||||
var link = next.querySelector('h3 a') || next.querySelector('a');
|
||||
if (link !== null) {
|
||||
link.focus();
|
||||
}
|
||||
}
|
||||
if (!noScroll) {
|
||||
scrollPageToSelected();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue