From 2372112bcdf3acd0cdd9fb4c593d62b963d93e80 Mon Sep 17 00:00:00 2001 From: Sharypov Artem <79115666058@ya.ru> Date: Wed, 19 Feb 2025 21:56:03 +0300 Subject: [PATCH] fix(material/select): added ecs click handling in host keydown The esc button was processed only in the overlay, which led to the container not closing in sidenav. Fixes #30507 --- src/material/select/select.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/material/select/select.ts b/src/material/select/select.ts index 556debb4b0b3..fb24f669f16f 100644 --- a/src/material/select/select.ts +++ b/src/material/select/select.ts @@ -1033,6 +1033,10 @@ export class MatSelect hasDeselectedOptions ? option.select() : option.deselect(); } }); + } else if (event.keyCode === ESCAPE && !hasModifierKey(event)) { + event.stopPropagation(); + event.preventDefault(); + this.close(); } else { const previouslyFocusedIndex = manager.activeItemIndex;