Skip to content

Commit d86a391

Browse files
committed
fix(expansion-panel): arrow not centered vertically and incorrect title font weight
* Fixes the arrow in the expansion panel header not being quite centered, due to it being based on a rotated CSS triangle. These changes switch to use an SVG which is much easier to reason about. * Uses the correct font weight for the panel header's title.
1 parent 6a7fc81 commit d86a391

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/material/expansion/_expansion-theme.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
}
4242

4343
.mat-expansion-panel-header-description,
44-
.mat-expansion-indicator::after {
44+
.mat-expansion-indicator {
4545
color: mat-color($foreground, secondary-text);
4646
}
4747

@@ -67,4 +67,8 @@
6767
.mat-expansion-panel-content {
6868
@include mat-typography-level-to-styles($config, body-1);
6969
}
70+
71+
.mat-expansion-panel-header-title {
72+
font-weight: mat-font-weight($config, title);
73+
}
7074
}

src/material/expansion/expansion-panel-header.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
<ng-content select="mat-panel-description"></ng-content>
44
<ng-content></ng-content>
55
</span>
6-
<span [@indicatorRotate]="_getExpandedState()" *ngIf="_showToggle()"
7-
class="mat-expansion-indicator"></span>
6+
7+
<svg [@indicatorRotate]="_getExpandedState()" *ngIf="_showToggle()"
8+
class="mat-expansion-indicator" viewBox="0 0 24 24">
9+
<path d="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"/>
10+
</svg>

src/material/expansion/expansion-panel-header.scss

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,9 @@
5151
flex-grow: 2;
5252
}
5353

54-
/**
55-
* Creates the expansion indicator arrow. Done using ::after rather than having
56-
* additional nodes in the template.
57-
*/
58-
.mat-expansion-indicator::after {
59-
border-style: solid;
60-
border-width: 0 2px 2px 0;
61-
content: '';
54+
.mat-expansion-indicator {
6255
display: inline-block;
63-
padding: 3px;
64-
transform: rotate(45deg);
65-
vertical-align: middle;
56+
width: 24px;
57+
height: 24px;
58+
fill: currentColor;
6659
}

0 commit comments

Comments
 (0)