Skip to content

Commit

Permalink
fix(material/autocomplete): autocomplete panel top cut off in landsca…
Browse files Browse the repository at this point in the history
…pe mode

Fixes a bug in the Angular Material Autocomplete component where the
autocomplete panel listbox is cut off by the device screen when being
viewed in landscape mode. This is because the CDK overlay does not
adjust its size based on the screen constraints when triggered.

Fixes b/284148377
  • Loading branch information
essjay05 committed May 1, 2024
1 parent 988f2b7 commit fe21a54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/material/autocomplete/autocomplete-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,9 @@ export class MatAutocompleteTrigger
const strategy = this._overlay
.position()
.flexibleConnectedTo(this._getConnectedElement())
.withFlexibleDimensions(false)
.withFlexibleDimensions(true)
.withGrowAfterOpen(true)
.withViewportMargin(8)
.withPush(false);

this._setStrategyPositions(strategy);
Expand Down
7 changes: 0 additions & 7 deletions src/material/autocomplete/autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,3 @@ div.mat-mdc-autocomplete-panel {
mat-autocomplete {
display: none;
}

// Prevents autocomplete panel from being cut-off from being viewed in landscape orientation.
@media all and (orientation: landscape) {
div.mat-mdc-autocomplete-panel {
max-height: 55vh;
}
}

0 comments on commit fe21a54

Please sign in to comment.