[FIX] prevent an incorrect state in autocompletion
authorGéry Debongnie <ged@odoo.com>
Tue, 1 Jul 2014 07:39:26 +0000 (09:39 +0200)
committerGéry Debongnie <ged@odoo.com>
Tue, 1 Jul 2014 07:39:26 +0000 (09:39 +0200)
When going up and wrapping around, the focus was on a hidden separator,
so hitting enter = stacktrace.  Now, the focus goes on the last
selectable list item.-

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

index 4b00f6f..1bfdc86 100644 (file)
@@ -2505,7 +2505,7 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({
             if (!$next.length) $next = this.$('li:first-child');
         } else {
             $next = this.$('li.oe-selection-focus').prevAll(':not(.oe-separator)').first();
-            if (!$next.length) $next = this.$('li:last-child');
+            if (!$next.length) $next = this.$('li:not(.oe-separator)').last();
         }
         this.focus_element($next);
     },