summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2023-04-10 15:42:11 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2023-04-10 16:26:41 +0200
commit962b4c719fa7ca32470fa4d092130c3d27c2d45f (patch)
tree51b80094a893a3586a4d5a8215b8b0dcae543547 /searx
parente9fb9f2705f9d91bfcb57016061d10c77e8ad0c0 (diff)
[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>
Diffstat (limited to 'searx')
-rw-r--r--searx/static/themes/simple/src/js/main/search.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/searx/static/themes/simple/src/js/main/search.js b/searx/static/themes/simple/src/js/main/search.js
index ceb17958b..cb2a9d882 100644
--- a/searx/static/themes/simple/src/js/main/search.js
+++ b/searx/static/themes/simple/src/js/main/search.js
@@ -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);
}