Skip to content

fix(tabs): group alignment propagating to nested groups #19037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/material-experimental/mdc-tabs/_tabs-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@ $mat-tab-animation-duration: 500ms !default;
}

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

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

[mat-align-tabs='end'] & {
[mat-align-tabs='end'] > #{$parent} & {
justify-content: flex-end;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-tabs/tab-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
}

.mat-mdc-tab-labels {
@include mat-mdc-paginated-tab-header-item-wrapper;
@include mat-mdc-paginated-tab-header-item-wrapper('.mat-mdc-tab-header');
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@include mat-mdc-paginated-tab-header;

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

.mat-mdc-tab-link-container {
Expand Down
8 changes: 5 additions & 3 deletions src/material/tabs/_tabs-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,16 @@ $mat-tab-animation-duration: 500ms !default;
}

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

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

[mat-align-tabs='end'] & {
[mat-align-tabs='end'] > #{$parent} & {
justify-content: flex-end;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/material/tabs/tab-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

.mat-tab-labels {
@include paginated-tab-header-item-wrapper;
@include paginated-tab-header-item-wrapper('.mat-tab-header');
}

.mat-tab-label-container {
Expand Down
2 changes: 1 addition & 1 deletion src/material/tabs/tab-nav-bar/tab-nav-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@include paginated-tab-header;

.mat-tab-links {
@include paginated-tab-header-item-wrapper;
@include paginated-tab-header-item-wrapper('.mat-tab-link-container');
}

.mat-ink-bar {
Expand Down