Skip to content

Commit 2dc8d8d

Browse files
committed
fix(material/expansion): all panels appearing open when printing
Fixes that closed expansion panel were appearing as open when printing the page. Fixes #32327.
1 parent ef53e73 commit 2dc8d8d

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

src/material/expansion/expansion-panel.scss

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ $fallbacks: m3-expansion.get-tokens();
5151
}
5252
}
5353

54+
// Styles to use if grid isn't supported for some reason.
55+
@mixin _fallback-styles {
56+
height: 0;
57+
58+
.mat-expansion-panel.mat-expanded > & {
59+
height: auto;
60+
}
61+
}
62+
5463
.mat-expansion-panel-content-wrapper {
5564
// Note: we can't use `overflow: hidden` here, because it can clip content with
5665
// ripples or box shadows. Instead we transition the `visibility` below.
@@ -72,13 +81,14 @@ $fallbacks: m3-expansion.get-tokens();
7281
// we have a fallback to `height` which doesn't animate, just in case.
7382
// stylelint-disable material/no-prefixes
7483
@supports not (grid-template-rows: 0fr) {
75-
height: 0;
76-
77-
.mat-expansion-panel.mat-expanded > & {
78-
height: auto;
79-
}
84+
@include _fallback-styles;
8085
}
8186
// stylelint-enable material/no-prefixes
87+
88+
// Use the fallback styles when printing, otherwise closed panel appear open (see #32327).
89+
@media print {
90+
@include _fallback-styles;
91+
}
8292
}
8393

8494
.mat-expansion-panel-content {

0 commit comments

Comments
 (0)