Bugfix: Popup Escape/Close key failed

This commit is contained in:
the-djmaze 2022-02-25 13:13:09 +01:00
parent b82d26b71b
commit 65a3b9e4c7

View file

@ -59,8 +59,6 @@ export class AbstractViewPopup extends AbstractView
super('Popups' + name, ViewType.Popup); super('Popups' + name, ViewType.Popup);
this.keyScope.scope = name; this.keyScope.scope = name;
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 }); this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
this.onClose = this.onClose.debounce(200);
shortcuts.add('escape,close', '', name, () => { shortcuts.add('escape,close', '', name, () => {
if (this.modalVisibility() && this.onClose()) { if (this.modalVisibility() && this.onClose()) {
this.closeCommand(); this.closeCommand();
@ -71,9 +69,9 @@ export class AbstractViewPopup extends AbstractView
shortcuts.add('backspace', '', name, inFocus()); shortcuts.add('backspace', '', name, inFocus());
} }
// Happens when user hits Escape key // Happens when user hits Escape or Close key
onClose() { onClose() {
return true; return true; // false to prevent closing
} }
/* /*