Skip to content

Commit

Permalink
fix(material/datepicker): content overflowing when large custom heade…
Browse files Browse the repository at this point in the history
…r 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)
  • Loading branch information
ramprakashram authored and amysorto committed Jan 28, 2022
1 parent 974d330 commit d8ddfb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/material/datepicker/datepicker-content.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div
cdkTrapFocus
class="mat-datepicker-content-container"
[class.mat-datepicker-content-container-with-custom-header]="datepicker.calendarHeaderComponent"
[class.mat-datepicker-content-container-with-actions]="_actionsPortal">
<mat-calendar
[id]="datepicker.id"
Expand Down
7 changes: 7 additions & 0 deletions src/material/datepicker/datepicker-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ $touch-max-height: 788px;
height: $non-touch-calendar-height;
}

// Override mat-calendar's height when custom header is provided
// Height should be auto, when the custom header is provided.
// This will prevent the content from overflowing.
.mat-datepicker-content-container-with-custom-header .mat-calendar {
height: auto;
}

// Note that this selector doesn't technically have to be nested, but we want the slightly
// higher specificity, or it can be overridden based on the CSS insertion order (see #21043).
.mat-datepicker-close-button {
Expand Down

0 comments on commit d8ddfb0

Please sign in to comment.