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