[IMP] close search autocompletion list while completing
authorXavier Morel <xmo@openerp.com>
Wed, 5 Jun 2013 14:49:49 +0000 (16:49 +0200)
committerXavier Morel <xmo@openerp.com>
Wed, 5 Jun 2013 14:49:49 +0000 (16:49 +0200)
Looks slightly worse as results don't seamlessly update in-place, but
limits/avoids the risk of quick-typing, hitting [Return] and getting
an incomplete/incorrect query because the completion didn't catch up
(e.g. slow network) and [Return] validated the previously retrieved
completion.

lp bug: https://launchpad.net/bugs/1183746 fixed

bzr revid: xmo@openerp.com-20130605144949-jbzs2hppr6c1djg3

addons/web/static/src/js/search.js

index 9a111cf..2097cd6 100644 (file)
@@ -471,11 +471,12 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
         var autocomplete = this.$el.autocomplete({
             source: this.proxy('complete_global_search'),
             select: this.proxy('select_completion'),
+            search: function () { self.$el.autocomplete('close'); },
             focus: function (e) { e.preventDefault(); },
             html: true,
             autoFocus: true,
             minLength: 1,
-            delay: 0
+            delay: 0,
         }).data('autocomplete');
 
         // MonkeyPatch autocomplete instance