Skip to content

Commit 5224ac2

Browse files
authored
fix(tabs): group alignment propagating to nested groups (#19037)
The selector that applies the alignment to the tab header was too broad which meant that it was applying to any nested tab groups. Fixes #19035.
1 parent 1cf4048 commit 5224ac2

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

src/material-experimental/mdc-tabs/_tabs-common.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,18 @@ $mat-tab-animation-duration: 500ms !default;
144144
}
145145

146146
// Structural styles for the element that wraps the paginated header items.
147-
@mixin mat-mdc-paginated-tab-header-item-wrapper {
147+
@mixin mat-mdc-paginated-tab-header-item-wrapper($parent) {
148148
display: flex;
149149
flex: 1 0 auto;
150150

151+
// We need to set the parent here explicitly, in order to prevent the alignment
152+
// from any parent tab groups from propagating down to the children when nesting.
151153
// Note that these are used as inputs so they shouldn't be changed to `mat-mdc-`.
152-
[mat-align-tabs='center'] & {
154+
[mat-align-tabs='center'] > #{$parent} & {
153155
justify-content: center;
154156
}
155157

156-
[mat-align-tabs='end'] & {
158+
[mat-align-tabs='end'] > #{$parent} & {
157159
justify-content: flex-end;
158160
}
159161
}

src/material-experimental/mdc-tabs/tab-header.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
}
1818

1919
.mat-mdc-tab-labels {
20-
@include mat-mdc-paginated-tab-header-item-wrapper;
20+
@include mat-mdc-paginated-tab-header-item-wrapper('.mat-mdc-tab-header');
2121
}

src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@include mat-mdc-paginated-tab-header;
77

88
.mat-mdc-tab-links {
9-
@include mat-mdc-paginated-tab-header-item-wrapper;
9+
@include mat-mdc-paginated-tab-header-item-wrapper('.mat-mdc-tab-link-container');
1010
}
1111

1212
.mat-mdc-tab-link-container {

src/material/tabs/_tabs-common.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,16 @@ $mat-tab-animation-duration: 500ms !default;
138138
}
139139

140140
// Structural styles for the element that wraps the paginated header items.
141-
@mixin paginated-tab-header-item-wrapper {
141+
@mixin paginated-tab-header-item-wrapper($parent) {
142142
display: flex;
143143

144-
[mat-align-tabs='center'] & {
144+
// We need to set the parent here explicitly, in order to prevent the alignment
145+
// from any parent tab groups from propagating down to the children when nesting.
146+
[mat-align-tabs='center'] > #{$parent} & {
145147
justify-content: center;
146148
}
147149

148-
[mat-align-tabs='end'] & {
150+
[mat-align-tabs='end'] > #{$parent} & {
149151
justify-content: flex-end;
150152
}
151153
}

src/material/tabs/tab-header.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99

1010
.mat-tab-labels {
11-
@include paginated-tab-header-item-wrapper;
11+
@include paginated-tab-header-item-wrapper('.mat-tab-header');
1212
}
1313

1414
.mat-tab-label-container {

src/material/tabs/tab-nav-bar/tab-nav-bar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@include paginated-tab-header;
55

66
.mat-tab-links {
7-
@include paginated-tab-header-item-wrapper;
7+
@include paginated-tab-header-item-wrapper('.mat-tab-link-container');
88
}
99

1010
.mat-ink-bar {

0 commit comments

Comments
 (0)