From 8174095a206de04d1594bba94041ba30369826cf Mon Sep 17 00:00:00 2001 From: aj-rosado <109146700+aj-rosado@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:24:02 +0100 Subject: [PATCH] [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 --- apps/browser/src/popup/vault/vault-select.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/browser/src/popup/vault/vault-select.component.ts b/apps/browser/src/popup/vault/vault-select.component.ts index 4ed1dead32c..d9dca42f24c 100644 --- a/apps/browser/src/popup/vault/vault-select.component.ts +++ b/apps/browser/src/popup/vault/vault-select.component.ts @@ -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) => {