Skip to content

Commit d8ddfb0

Browse files
ramprakashramamysorto
authored andcommitted
fix(material/datepicker): content overflowing when large custom header is provided (#24255)
* fix(material/datepicker): content overflowing when large custom header is provided Fixes a bug in the Angular Material `datepicker` component where the content of the datepicker is overflowing outside when a custom header with large height is provided. This is because of the fixed height provided is not enough with custom headers, so added a new class which will set the height of calendar to auto when custom header is given. Fixes #20459 * fix(material/datepicker): content overflowing when large custom header is provided Fixes a bug in the Angular Material `datepicker` component where the content of the datepicker is overflowing outside when a custom header with large height is provided. This commit adds comments for the changes done for this bug. Fixes #20459 * fix(material/datepicker): content overflowing when large custom header is provided Fixes a bug in the Angular Material `datepicker` component where the content of the datepicker is overflowing outside when a custom header with large height is provided. This commit updates the html to use plain class instead of ngClass and removes the $non-touch-custom-header-calendar-height scss variable. Fixes #20459 (cherry picked from commit 1933225)
1 parent 974d330 commit d8ddfb0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/material/datepicker/datepicker-content.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div
22
cdkTrapFocus
33
class="mat-datepicker-content-container"
4+
[class.mat-datepicker-content-container-with-custom-header]="datepicker.calendarHeaderComponent"
45
[class.mat-datepicker-content-container-with-actions]="_actionsPortal">
56
<mat-calendar
67
[id]="datepicker.id"

src/material/datepicker/datepicker-content.scss

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ $touch-max-height: 788px;
3131
height: $non-touch-calendar-height;
3232
}
3333

34+
// Override mat-calendar's height when custom header is provided
35+
// Height should be auto, when the custom header is provided.
36+
// This will prevent the content from overflowing.
37+
.mat-datepicker-content-container-with-custom-header .mat-calendar {
38+
height: auto;
39+
}
40+
3441
// Note that this selector doesn't technically have to be nested, but we want the slightly
3542
// higher specificity, or it can be overridden based on the CSS insertion order (see #21043).
3643
.mat-datepicker-close-button {

0 commit comments

Comments
 (0)