[mod] Update input when selecting by TAB

When the user press [TAB] the input form should be filled with the highlighted
item from the autocomplete list, but not release a search / with other words:
what we now have by pressing once on [ENTER] should be mapped to the [TAB] key
and pressing [ENTER] once should release a search query. [1]

[1] https://github.com/searxng/searxng/issues/778#issuecomment-1016593816

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
pull/2331/head
Markus Heiser 1 year ago
parent e9fb9f2705
commit 962b4c719f

@ -82,6 +82,21 @@
}
},
}),
"Tab": Object.assign({}, AutoComplete.defaults.KeyboardMappings.Enter, {
Conditions: [{
Is: 9,
Not: false
}],
Callback: function (event) {
if (this.DOMResults.getAttribute("class").indexOf("open") != -1) {
var liActive = this.DOMResults.querySelector("li.active");
if (liActive !== null) {
AutoComplete.defaults._Select.call(this, liActive);
event.preventDefault();
}
}
},
})
}),
}, "#" + qinput_id);
}

Loading…
Cancel
Save