[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:
parent
b625767f13
commit
8174095a20
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue