Skip to content

Commit

Permalink
[DOC] web: search view: extra info about key events handling
Browse files Browse the repository at this point in the history
Complements bde1a44
  • Loading branch information
odony committed Nov 24, 2014
1 parent bb5d32b commit 784665e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addons/web/static/src/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,8 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
ev.preventDefault();
return;
}
// ENTER is caugth at KeyUp rather than KeyDown to avoid firing
// before all regular keystrokes have been processed
if (ev.which === $.ui.keyCode.ENTER) {
if (self.current_result && self.get_search_string().length) {
self.select_item(ev);
Expand All @@ -2382,6 +2384,9 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
});
this.$input.on('keydown', function (ev) {
switch (ev.which) {
// TAB and direction keys are handled at KeyDown because KeyUp
// is not guaranteed to fire.
// See e.g. https://github.com/aef-/jquery.masterblaster/issues/13
case $.ui.keyCode.TAB:
if (self.current_result && self.get_search_string().length) {
self.select_item(ev);
Expand Down

0 comments on commit 784665e

Please sign in to comment.