Skip to content

Commit

Permalink
Closes overlaypanel on escape key press
Browse files Browse the repository at this point in the history
  • Loading branch information
navedqb committed Oct 19, 2023
1 parent 21e0575 commit 147fb1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/components/overlaypanel/overlaypanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ContentChildren,
ElementRef,
EventEmitter,
HostListener,
Inject,
Input,
NgModule,
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 147fb1a

Please sign in to comment.