[PS-1162] Preventing escape from closing popup when vault selector is open (#3195)

* PS-1162 Preventing escape from closing popup when vault selector is open

* PS-1162 attached escape target to HostListener
This commit is contained in:
aj-rosado 2022-08-05 15:24:02 +01:00 committed by GitHub
parent b625767f13
commit 8174095a20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import {
TemplateRef,
ViewChild,
ViewContainerRef,
HostListener,
} from "@angular/core";
import { merge } from "rxjs";
@ -87,6 +88,14 @@ export class VaultSelectComponent implements OnInit {
private platformUtilsService: PlatformUtilsService
) {}
@HostListener("document:keydown.escape", ["$event"])
handleKeyboardEvent(event: KeyboardEvent) {
if (this.isOpen) {
event.preventDefault();
this.close();
}
}
async ngOnInit() {
await this.load();
this.broadcasterService.subscribe(this.constructor.name, (message: any) => {