diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index d7331d2cda8..48a796987c8 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -1136,7 +1136,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
});
},
toggle_filter: function (e) {
- this.toggle(this.filters[$(e.target).index()]);
+ this.toggle(this.filters[Number($(e.target).data('index'))]);
},
toggle: function (filter) {
this.view.query.toggle(this.make_facet([this.make_value(filter)]));
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 1387da6f5fc..c9adc91a6ad 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1521,7 +1521,8 @@
-
+ t-att-title="filter.attrs.string ? filter.attrs.help : undefined"
+ t-att-data-index="filter_index">
diff --git a/addons/web/static/test/search.js b/addons/web/static/test/search.js
index ee7a7730ded..6c4b6d61d3c 100644
--- a/addons/web/static/test/search.js
+++ b/addons/web/static/test/search.js
@@ -1400,6 +1400,26 @@ openerp.testing.section('search.invisible', {
return done;
});
});
+ test('invisible-previous-sibling', {asserts: 3}, function (instance, $fix, mock) {
+ var view = makeView(instance, mock, {}, [
+ '',
+ '',
+ '',
+ '',
+ '',
+ ''].join(''));
+ return view.appendTo($fix)
+ .done(function () {
+ // Select filter 3
+ $fix.find('.oe_searchview_filters ul li:contains("filter 3")').click();
+ equal(view.query.length, 1, "should have selected a filter");
+ var facet = view.query.at(0);
+ strictEqual(facet.values.at(0).get('label'), "filter 3",
+ "should have correctly labelled the facet");
+ deepEqual(view.build_search_data().contexts, [{test: 3}],
+ "should have built correct context");
+ });
+ });
// Invisible filter groups should not appear in the drawer
// Group invisibility should be inherited by children
test('group-invisibility', {asserts: 6}, function (instance, $fix, mock) {