[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.
This commit is contained in:
parent
cc762004ed
commit
bde1a4432f
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue