Skip to content

Commit 253db84

Browse files
committed
fix(material/autocomplete): autocomplete panel gets cut off in mobile landscape
Updates fix to autocomplete panel which was getting cut off in mobile landscape by correctly assigning const isHandsetLandscape to the subscription result.matches value and thus if isHandsetLandscape is true then applying flexible dimensions, grow after open and with viewport margin to the panel on open. Fixes b/284148377
1 parent 4baf33c commit 253db84

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/material/autocomplete/autocomplete-trigger.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -900,18 +900,17 @@ export class MatAutocompleteTrigger
900900
this._handsetLandscapeBreakpointSubscription = this._breakpointObserver
901901
.observe(Breakpoints.HandsetLandscape)
902902
.subscribe(result => {
903-
return result.matches;
903+
// Check breakpoint if being viewed in HandsetLandscape via subscription (if not null)
904+
const isHandsetLandscape = result.matches;
905+
// Apply HandsetLandscape settings to prevent overlay cutoff in that breakpoint
906+
// Fixes b/284148377
907+
if (isHandsetLandscape) {
908+
strategy.withFlexibleDimensions(true).withGrowAfterOpen(true).withViewportMargin(8);
909+
}
910+
return;
904911
});
905912
}
906913

907-
// Check breakpoint if being viewed in HandsetLandscape via subscription (if not null)
908-
const isHandsetLandscape = this._handsetLandscapeBreakpointSubscription;
909-
// Apply HandsetLandscape settings to prevent overlay cutoff in that breakpoint
910-
// Fixes b/284148377
911-
if (isHandsetLandscape) {
912-
strategy.withFlexibleDimensions(true).withGrowAfterOpen(true).withViewportMargin(8);
913-
}
914-
915914
this._setStrategyPositions(strategy);
916915
this._positionStrategy = strategy;
917916
return strategy;

0 commit comments

Comments
 (0)