From 9ae16f2eddda81a246db83c818703174fa9c16bb Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 9 Jun 2023 09:02:13 +0200 Subject: [PATCH] fix(material/select): provide horizontal fallback positions The select had configured its positions under the assumption that the dropdown is always as wide as the trigger so it only provided a vertical fallback position. Since users are now able to control the panel width, we also need horizontal fallbacks. Fixes #27256. --- src/material/select/select.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/material/select/select.ts b/src/material/select/select.ts index 47856141a745..8abddb070140 100644 --- a/src/material/select/select.ts +++ b/src/material/select/select.ts @@ -1303,6 +1303,12 @@ export class MatSelect extends _MatSelectBase implements OnInit overlayX: 'start', overlayY: 'top', }, + { + originX: 'end', + originY: 'bottom', + overlayX: 'end', + overlayY: 'top', + }, { originX: 'start', originY: 'top', @@ -1310,6 +1316,13 @@ export class MatSelect extends _MatSelectBase implements OnInit overlayY: 'bottom', panelClass: 'mat-mdc-select-panel-above', }, + { + originX: 'end', + originY: 'top', + overlayX: 'end', + overlayY: 'bottom', + panelClass: 'mat-mdc-select-panel-above', + }, ]; /** Ideal origin for the overlay panel. */