Skip to content

Commit

Permalink
Merge pull request #13931 from qburst/close-overlay-panel-on-escape
Browse files Browse the repository at this point in the history
fix(overlaypanel): close overlay panel on escape key press
  • Loading branch information
cetincakiroglu committed Oct 25, 2023
2 parents cb2d8eb + 5a0458e commit 5293243
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 5293243

Please sign in to comment.