summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-05-02 17:08:08 +0200
committerXavier Morel <xmo@openerp.com>2012-05-02 17:08:08 +0200
commitdce41d8aeaf9e4449ca56d51fbe82b103b04643e (patch)
treedadda14cc68b8bfd2a1563e9eb9eba6701cd7421 /addons/web/static/src
parentf009c765984eb8b409dc42f7bb601acf14e6b577 (diff)
[ADD] automatic selection of first completion item in the list
bzr revid: xmo@openerp.com-20120502150808-jpqiq63574ds2c1g
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/search.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index 72b05df1317..eea51b1861b 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -286,6 +286,15 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
this.$element.on('blur', function () {
self.$element.removeClass('oe_focused');
});
+ // when the completion list opens/refreshes, automatically select the
+ // first completion item so if the user just hits [RETURN] or [TAB] it
+ // automatically selects it
+ this.$element.on('autocompleteopen', function () {
+ var menu = self.$element.data('autocomplete').menu;
+ menu.activate(
+ $.Event({ type: "mouseenter" }),
+ menu.element.children().first());
+ });
return $.when(p, this.ready);
},