Skip to content

Commit 52df086

Browse files
committed
fix(material/table): increase specificity on sticky selector
The sticky styles were switched to a class in #19823 which has a very low specificity. As a result, there's a high chance of it being overwritten by some user styles. These changes nest the selector so it's a bit harder to override Fixes #20558.
1 parent 71b7b15 commit 52df086

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/material-experimental/mdc-table/table.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
@include mdc-data-table-core-styles($query: $mat-base-styles-without-animation-query);
77
@include mat-private-table-flex-styles();
88

9-
.mat-mdc-table-sticky {
9+
// Note that this uses a nested selector in order to increase the specificity and to ensure
10+
// that the sticky styles apply over any others that may have been added afterwards. (See #19823).
11+
.mat-mdc-table .mat-mdc-table-sticky {
1012
@include vendor-prefixes.position-sticky;
1113
}
1214

src/material/table/table.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ th.mat-header-cell, td.mat-cell, td.mat-footer-cell {
5252
}
5353
}
5454

55-
.mat-table-sticky {
55+
// Note that this uses a nested selector in order to increase the specificity and to ensure
56+
// that the sticky styles apply over any others that may have been added afterwards. (See #19823).
57+
.mat-table .mat-table-sticky {
5658
@include vendor-prefixes.position-sticky;
5759
}
5860

0 commit comments

Comments
 (0)