');
var autofocusTab = -1;
// renderedTabs is used to aggregate the generated $headers and $pages
// alongside their node, so that their modifiers can be registered once
@@ -785,7 +786,7 @@ var FormRenderer = BasicRenderer.extend({
});
if (renderedTabs.length) {
var tabToFocus = renderedTabs[Math.max(0, autofocusTab)];
- tabToFocus.$header.addClass('active');
+ tabToFocus.$header.find('.nav-link').addClass('active');
tabToFocus.$page.addClass('active');
}
// register the modifiers for each tab
@@ -793,12 +794,13 @@ var FormRenderer = BasicRenderer.extend({
self._registerModifiers(tab.node, self.state, tab.$header, {
callback: function (element, modifiers) {
// if the active tab is invisible, activate the first visible tab instead
- if (modifiers.invisible && element.$el.hasClass('active')) {
- element.$el.removeClass('active');
+ var $link = element.$el.find('.nav-link');
+ if (modifiers.invisible && $link.hasClass('active')) {
+ $link.removeClass('active');
tab.$page.removeClass('active');
- var $firstVisibleTab = $headers.find('li:not(.o_invisible_modifier):first()');
+ var $firstVisibleTab = $headers.find('li:not(.o_invisible_modifier):first() > a');
$firstVisibleTab.addClass('active');
- $pages.find($firstVisibleTab.find('a').attr('href')).addClass('active');
+ $pages.find($firstVisibleTab.attr('href')).addClass('active');
}
},
});
diff --git a/addons/web/static/src/scss/bootstrap_overridden.scss b/addons/web/static/src/scss/bootstrap_overridden.scss
index 20c99bf341b..9c26fa886eb 100644
--- a/addons/web/static/src/scss/bootstrap_overridden.scss
+++ b/addons/web/static/src/scss/bootstrap_overridden.scss
@@ -101,9 +101,6 @@ $dropdown-link-hover-bg: $gray-200;
// Navs
-$nav-link-padding-y: 10px;
-$nav-link-padding-x: 15px;
-
$nav-tabs-link-active-bg: $white;
$nav-pills-border-radius: 0;
diff --git a/addons/web/static/src/scss/webclient.scss b/addons/web/static/src/scss/webclient.scss
index cb122b084f2..b90b6f5fee5 100644
--- a/addons/web/static/src/scss/webclient.scss
+++ b/addons/web/static/src/scss/webclient.scss
@@ -17,7 +17,7 @@
width: 300px;
max-width: 100%;
- @include o-position-absolute($navbar-height, 0px);
+ @include o-position-absolute($nav-link-height, 0);
z-index: 1100; // Bootstrap modal z-index is 1050
.o_notification {
diff --git a/addons/web/static/src/xml/kanban.xml b/addons/web/static/src/xml/kanban.xml
index 4fc71cd6074..881babbda23 100644
--- a/addons/web/static/src/xml/kanban.xml
+++ b/addons/web/static/src/xml/kanban.xml
@@ -124,10 +124,10 @@
-
+
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js
index dc80d6440b3..ce8b1f33ef4 100644
--- a/addons/web/static/tests/views/form_tests.js
+++ b/addons/web/static/tests/views/form_tests.js
@@ -504,20 +504,20 @@ QUnit.module('Views', {
});
form.$buttons.find('.o_form_button_edit').click();
- assert.ok(form.$('.o_notebook .nav li:first()').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav .nav-link:first()').hasClass('active'),
'first tab should be active');
- assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('o_invisible_modifier'),
+ assert.ok(!form.$('.o_notebook .nav .nav-item:first()').hasClass('o_invisible_modifier'),
'first tab should be visible');
// set a value on the m2o
var $dropdown = form.$('.o_field_many2one input').autocomplete('widget');
form.$('.o_field_many2one input').click();
$dropdown.find('li:first()').click();
- assert.ok(!form.$('.o_notebook .nav li:first()').hasClass('active'),
+ assert.ok(!form.$('.o_notebook .nav .nav-link:first()').hasClass('active'),
'first tab should not be active');
- assert.ok(form.$('.o_notebook .nav li:first()').hasClass('o_invisible_modifier'),
+ assert.ok(form.$('.o_notebook .nav .nav-item:first()').hasClass('o_invisible_modifier'),
'first tab should be invisible');
- assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav .nav-link:nth(1)').hasClass('active'),
'second tab should be active');
assert.ok(form.$('.o_notebook .tab-content .tab-pane:nth(1)').hasClass('active'),
'second page should be active');
@@ -547,9 +547,9 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.notOk(form.$('.o_notebook .nav li:first()').is(':visible'),
+ assert.notOk(form.$('.o_notebook .nav .nav-item:first()').is(':visible'),
'first tab should be invisible');
- assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav .nav-link:nth(1)').hasClass('active'),
'second tab should be active');
form.destroy();
@@ -578,9 +578,9 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.notOk(form.$('.o_notebook .nav li:first()').hasClass('active'),
+ assert.notOk(form.$('.o_notebook .nav .nav-link:first()').hasClass('active'),
'first tab should not active');
- assert.ok(form.$('.o_notebook .nav li:nth(1)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav .nav-link:nth(1)').hasClass('active'),
'second tab should be active');
form.destroy();
@@ -2583,19 +2583,19 @@ QUnit.module('Views', {
});
// click on second page tab
- form.$('.o_notebook li:eq(1) a').click();
+ form.$('.o_notebook .nav-link:eq(1)').click();
- assert.notOk(form.$('.o_notebook li:eq(0)').hasClass('active'),
+ assert.notOk(form.$('.o_notebook .nav-link:eq(0)').hasClass('active'),
"first tab should not be active");
- assert.ok(form.$('.o_notebook li:eq(1)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav-link:eq(1)').hasClass('active'),
"second tab should be active");
// click on the pager to switch to the next record
form.pager.$('.o_pager_next').click();
- assert.notOk(form.$('.o_notebook li:eq(0)').hasClass('active'),
+ assert.notOk(form.$('.o_notebook .nav-link:eq(0)').hasClass('active'),
"first tab should not be active");
- assert.ok(form.$('.o_notebook li:eq(1)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav-link:eq(1)').hasClass('active'),
"second tab should be active");
form.destroy();
});
@@ -5152,23 +5152,23 @@ QUnit.module('Views', {
res_id: 1,
});
- assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 2,
+ assert.strictEqual(form.$('.o_notebook .nav-item:not(.o_invisible_modifier)').length, 2,
"both tabs should be visible");
- assert.ok(form.$('.o_notebook ul li:first').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav-link:first').hasClass('active'),
"first tab should be active");
// click on the pager to switch to the next record
form.pager.$('.o_pager_next').click();
- assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 1,
+ assert.strictEqual(form.$('.o_notebook .nav-item:not(.o_invisible_modifier)').length, 1,
"only the second tab should be visible");
- assert.ok(form.$('.o_notebook ul li:not(.o_invisible_modifier)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav-item:not(.o_invisible_modifier) .nav-link').hasClass('active'),
"the visible tab should be active");
// click on the pager to switch back to the previous record
form.pager.$('.o_pager_previous').click();
- assert.strictEqual(form.$('.o_notebook ul li:not(.o_invisible_modifier)').length, 2,
+ assert.strictEqual(form.$('.o_notebook .nav-item:not(.o_invisible_modifier)').length, 2,
"both tabs should be visible again");
- assert.ok(form.$('.o_notebook ul li:nth(1)').hasClass('active'),
+ assert.ok(form.$('.o_notebook .nav-link:nth(1)').hasClass('active'),
"second tab should be active");
form.destroy();
diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml
index 1224accd6cb..2039acc7bdc 100644
--- a/addons/web/views/webclient_templates.xml
+++ b/addons/web/views/webclient_templates.xml
@@ -394,17 +394,17 @@