impr: stop propagation of escape events

!nuf
This commit is contained in:
Miodec 2024-09-25 13:33:34 +02:00
parent 245c09bc0b
commit 52d84836cf
2 changed files with 4 additions and 0 deletions

View file

@ -646,6 +646,8 @@ const modal = new AnimatedModal({
}
}
if (e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
await goBackOrHide();
}
});

View file

@ -134,6 +134,8 @@ export default class AnimatedModal<
async runSetup(): Promise<void> {
this.wrapperEl.addEventListener("keydown", (e) => {
if (e.key === "Escape" && isPopupVisible(this.dialogId)) {
e.preventDefault();
e.stopPropagation();
if (this.customEscapeHandler !== undefined) {
this.customEscapeHandler(e);
} else {