mirror of
https://github.com/searxng/searxng.git
synced 2024-11-23 03:11:00 +00:00
[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>
This commit is contained in:
parent
e9fb9f2705
commit
962b4c719f
1 changed files with 15 additions and 0 deletions
|
@ -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…
Reference in a new issue