From c1a497f58c1710e354c4a531d8bda59d7d0ab962 Mon Sep 17 00:00:00 2001 From: ylorber Date: Wed, 6 May 2026 09:58:50 +0200 Subject: [PATCH] fix(material/select): stop event propagation on keyboard close in inline popover mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When mat-select uses inline popover positioning (the default), the CDK overlay host is inserted inside the mat-select host element. This caused keydown events (ENTER, SPACE, ALT+Arrow) handled by the open panel to bubble up to the host element's listener, which then ran _handleClosedKeydown and immediately re-opened the panel. Fixed by calling event.stopPropagation() in _handleOpenKeydown for the ENTER/SPACE selection and ALT+Arrow close branches. Also added a focus() call before close() in the ALT+Arrow branch so focus is explicitly restored to the trigger before the overlay detaches, consistent with the Tab and ENTER paths. This bug was particularly noticeable with screen readers since the panel would re-open immediately after selection, causing aria-expanded to toggle true→false→true in a single frame and confusing the a11y tree. --- src/material/select/select.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/material/select/select.ts b/src/material/select/select.ts index 94efdfec1f28..8e153c842b64 100644 --- a/src/material/select/select.ts +++ b/src/material/select/select.ts @@ -942,6 +942,11 @@ export class MatSelect if (isArrowKey && event.altKey) { // Close the select on ALT + arrow key to match the native