From 147fb1aa91f7567526fa1f63ed4786e725cc6ba4 Mon Sep 17 00:00:00 2001 From: navedqb Date: Fri, 20 Oct 2023 00:25:06 +0530 Subject: [PATCH] Closes overlaypanel on escape key press --- src/app/components/overlaypanel/overlaypanel.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/components/overlaypanel/overlaypanel.ts b/src/app/components/overlaypanel/overlaypanel.ts index dc54dc80eac..ef2749b54d4 100755 --- a/src/app/components/overlaypanel/overlaypanel.ts +++ b/src/app/components/overlaypanel/overlaypanel.ts @@ -8,6 +8,7 @@ import { ContentChildren, ElementRef, EventEmitter, + HostListener, Inject, Input, NgModule, @@ -422,6 +423,11 @@ export class OverlayPanel implements AfterContentInit, OnDestroy { this.hide(); event.preventDefault(); } + + @HostListener('document:keydown.escape', ['$event']) + onEscapeKeydown(event: KeyboardEvent) { + this.hide() + } onWindowResize() { if (this.overlayVisible && !DomHandler.isTouchDevice()) {