Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/src/ts/event-handlers/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ document.addEventListener("keydown", async (e) => {
}
});

//stop space scrolling
window.addEventListener("keydown", function (e) {
if (
e.code === "Space" &&
(e.target === document.body || (e.target as HTMLElement)?.id === "result")
) {
e.preventDefault();
}
});

window.onerror = function (message, url, line, column, error): void {
if (Misc.isDevEnvironment()) {
Notifications.add(error?.message ?? "Undefined message", -1, {
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/ts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ if (isDevEnvironment()) {
);
}

//stop space scrolling
window.addEventListener("keydown", function (e) {
if (
e.code === "Space" &&
(e.target === document.body || (e.target as HTMLElement)?.id === "result")
) {
e.preventDefault();
}
});

window.addEventListener("beforeunload", (event) => {
// Cancel the event as stated by the standard.
if (
Expand Down
32 changes: 24 additions & 8 deletions frontend/src/ts/utils/animated-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ export default class AnimatedModal<
this.focusFirstInput(options?.focusFirstInput);
}, 1);

const hasModalAnimation =
(options?.customAnimation?.modal ??
this.customHideAnimations?.modal) !== undefined;

const modalAnimation = options?.customAnimation?.modal ??
this.customShowAnimations?.modal ?? {
opacity: [0, 1],
Expand All @@ -269,10 +273,14 @@ export default class AnimatedModal<
: options?.animationMode ?? "both";

if (animationMode === "both" || animationMode === "none") {
animate(this.modalEl, {
...modalAnimation,
duration: animationMode === "none" ? 0 : modalAnimationDuration,
});
if (hasModalAnimation) {
animate(this.modalEl, {
...modalAnimation,
duration: animationMode === "none" ? 0 : modalAnimationDuration,
});
} else {
this.modalEl.style.opacity = "1";
}

animate(this.wrapperEl, {
...wrapperAnimation,
Expand Down Expand Up @@ -322,6 +330,10 @@ export default class AnimatedModal<

await options?.beforeAnimation?.(this.modalEl);

const hasModalAnimation =
(options?.customAnimation?.modal ??
this.customHideAnimations?.modal) !== undefined;

const modalAnimation = options?.customAnimation?.modal ??
this.customHideAnimations?.modal ?? {
opacity: [1, 0],
Expand Down Expand Up @@ -351,10 +363,14 @@ export default class AnimatedModal<
: options?.animationMode ?? "both";

if (animationMode === "both" || animationMode === "none") {
animate(this.modalEl, {
...modalAnimation,
duration: animationMode === "none" ? 0 : modalAnimationDuration,
});
if (hasModalAnimation) {
animate(this.modalEl, {
...modalAnimation,
duration: animationMode === "none" ? 0 : modalAnimationDuration,
});
} else {
this.modalEl.style.opacity = "1";
}

animate(this.wrapperEl, {
...wrapperAnimation,
Expand Down
Loading