mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-06 13:40:16 +08:00
impr: stop propagation of escape events
!nuf
This commit is contained in:
parent
245c09bc0b
commit
52d84836cf
2 changed files with 4 additions and 0 deletions
|
@ -646,6 +646,8 @@ const modal = new AnimatedModal({
|
|||
}
|
||||
}
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
await goBackOrHide();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue