Skip to content

Commit ca4a7a4

Browse files
kseamonandrewseguin
authored andcommitted
perf(material/table): Use text-align: start instead of descendent dir selector. (#32585)
(cherry picked from commit 89bdf48)
1 parent 66e2a08 commit ca4a7a4

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/material/table/table.scss

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ $fallbacks: m3-table.get-tokens();
1414

1515
@mixin _cell-border {
1616
border-bottom-color: token-utils.slot(
17-
table-row-item-outline-color, $fallbacks, rgba(0, 0, 0, 0.12));
17+
table-row-item-outline-color,
18+
$fallbacks,
19+
rgba(0, 0, 0, 0.12)
20+
);
1821
border-bottom-width: token-utils.slot(table-row-item-outline-width, $fallbacks, 1px);
1922
border-bottom-style: solid;
2023
}
@@ -39,12 +42,8 @@ $fallbacks: m3-table.get-tokens();
3942
.mdc-data-table__cell {
4043
box-sizing: border-box;
4144
overflow: hidden;
42-
text-align: left;
45+
text-align: start;
4346
text-overflow: ellipsis;
44-
45-
[dir='rtl'] & {
46-
text-align: right;
47-
}
4847
}
4948

5049
.mdc-data-table__cell,
@@ -87,7 +86,10 @@ $fallbacks: m3-table.get-tokens();
8786
height: token-utils.slot(table-footer-container-height, $fallbacks, 52px);
8887
color: token-utils.slot(table-row-item-label-text-color, $fallbacks, rgba(0, 0, 0, 0.87));
8988
font-family: token-utils.slot(
90-
table-footer-supporting-text-font, $fallbacks, (Roboto, sans-serif));
89+
table-footer-supporting-text-font,
90+
$fallbacks,
91+
(Roboto, sans-serif)
92+
);
9193
line-height: token-utils.slot(table-footer-supporting-text-line-height, $fallbacks);
9294
font-size: token-utils.slot(table-footer-supporting-text-size, $fallbacks, 14px);
9395
font-weight: token-utils.slot(table-footer-supporting-text-weight, $fallbacks);
@@ -103,11 +105,7 @@ $fallbacks: m3-table.get-tokens();
103105
text-overflow: ellipsis;
104106
overflow: hidden;
105107
outline: none;
106-
text-align: left;
107-
108-
[dir='rtl'] & {
109-
text-align: right;
110-
}
108+
text-align: start;
111109

112110
.mdc-data-table__row:last-child > & {
113111
border-bottom: none;
@@ -131,15 +129,22 @@ $fallbacks: m3-table.get-tokens();
131129
// MDC table rows are styled with a top border, whereas our legacy flex table styles rows with
132130
// a bottom border. Remove the bottom border style from the rows and let MDC display its top
133131
// border.
134-
mat-row.mat-mdc-row, mat-header-row.mat-mdc-header-row, mat-footer-row.mat-mdc-footer-row {
132+
mat-row.mat-mdc-row,
133+
mat-header-row.mat-mdc-header-row,
134+
mat-footer-row.mat-mdc-footer-row {
135135
border-bottom: none;
136136
}
137137

138138
// Cells need to inherit their background in order to overlap each other when sticky.
139139
// The background needs to be inherited from the table, tbody/tfoot, row, and cell.
140-
.mat-mdc-table tbody, .mat-mdc-table tfoot, .mat-mdc-table thead,
141-
.mat-mdc-cell, .mat-mdc-footer-cell,
142-
.mat-mdc-header-row, .mat-mdc-row, .mat-mdc-footer-row,
140+
.mat-mdc-table tbody,
141+
.mat-mdc-table tfoot,
142+
.mat-mdc-table thead,
143+
.mat-mdc-cell,
144+
.mat-mdc-footer-cell,
145+
.mat-mdc-header-row,
146+
.mat-mdc-row,
147+
.mat-mdc-footer-row,
143148
.mat-mdc-table .mat-mdc-header-cell {
144149
background: inherit;
145150
}

0 commit comments

Comments
 (0)