Skip to content
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

fix(table): incorrect padding for single-cell rows in rtl #20266

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 29 additions & 27 deletions src/material/table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,25 @@ mat-row, mat-header-row, mat-footer-row {
}
}

// Note: we use `first-of-type`/`last-of-type` here in order to prevent extra
// elements like ripples or badges from throwing off the layout (see #11165).
mat-cell:first-of-type, mat-header-cell:first-of-type, mat-footer-cell:first-of-type {
padding-left: $mat-row-horizontal-padding;
mat-cell, mat-header-cell, mat-footer-cell {
// Note: we use `first-of-type`/`last-of-type` here in order to prevent extra
// elements like ripples or badges from throwing off the layout (see #11165).
&:first-of-type {
padding-left: $mat-row-horizontal-padding;

[dir='rtl'] & {
padding-left: 0;
padding-right: $mat-row-horizontal-padding;
[dir='rtl'] &:not(:only-of-type) {
padding-left: 0;
padding-right: $mat-row-horizontal-padding;
}
}
}

mat-cell:last-of-type, mat-header-cell:last-of-type, mat-footer-cell:last-of-type {
padding-right: $mat-row-horizontal-padding;
&:last-of-type {
padding-right: $mat-row-horizontal-padding;

[dir='rtl'] & {
padding-right: 0;
padding-left: $mat-row-horizontal-padding;
[dir='rtl'] &:not(:only-of-type) {
padding-right: 0;
padding-left: $mat-row-horizontal-padding;
}
}
}

Expand Down Expand Up @@ -95,25 +97,25 @@ th.mat-header-cell, td.mat-cell, td.mat-footer-cell {
padding: 0;
border-bottom-width: 1px;
border-bottom-style: solid;
}

// Note: we use `first-of-type`/`last-of-type` here in order to prevent extra
// elements like ripples or badges from throwing off the layout (see #11165).
th.mat-header-cell:first-of-type, td.mat-cell:first-of-type, td.mat-footer-cell:first-of-type {
padding-left: $mat-row-horizontal-padding;
// Note: we use `first-of-type`/`last-of-type` here in order to prevent extra
// elements like ripples or badges from throwing off the layout (see #11165).
&:first-of-type {
padding-left: $mat-row-horizontal-padding;

[dir='rtl'] & {
padding-left: 0;
padding-right: $mat-row-horizontal-padding;
[dir='rtl'] &:not(:only-of-type) {
padding-left: 0;
padding-right: $mat-row-horizontal-padding;
}
}
}

th.mat-header-cell:last-of-type, td.mat-cell:last-of-type, td.mat-footer-cell:last-of-type {
padding-right: $mat-row-horizontal-padding;
&:last-of-type {
padding-right: $mat-row-horizontal-padding;

[dir='rtl'] & {
padding-right: 0;
padding-left: $mat-row-horizontal-padding;
[dir='rtl'] &:not(:only-of-type) {
padding-right: 0;
padding-left: $mat-row-horizontal-padding;
}
}
}

Expand Down