summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/search.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2014-11-20 10:26:13 +0100
committerDenis Ledoux <dle@odoo.com>2014-11-21 12:04:23 +0100
commitbde1a4432fef4cb2f5fe8ab600e72ab5b8b4830d (patch)
treea1e13001d16ddefc7c832912ff03ef3cadd3257e /addons/web/static/src/js/search.js
parentcc762004ede6d74a272cfbdc5ee8dc582da68158 (diff)
[FIX] fix autocompletion problems with quick presses
Problem was that when the user types quickly in the search bar and press enter, the keydown event of the enter key happens before the keypress event of the last key entered. This means that the autocompletion has a wrong string. The fix is to move the enter selection detection from keydown to keyup.
Diffstat (limited to 'addons/web/static/src/js/search.js')
-rw-r--r--addons/web/static/src/js/search.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index 9b155054774..e1b96d5d7fc 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -2362,6 +2362,12 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
ev.preventDefault();
return;
}
+ if (ev.which === $.ui.keyCode.ENTER) {
+ if (self.current_result && self.get_search_string().length) {
+ self.select_item(ev);
+ }
+ return;
+ }
if (!self.searching) {
self.searching = true;
return;
@@ -2377,7 +2383,6 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
this.$input.on('keydown', function (ev) {
switch (ev.which) {
case $.ui.keyCode.TAB:
- case $.ui.keyCode.ENTER:
if (self.current_result && self.get_search_string().length) {
self.select_item(ev);
}