fix: block interactions when animation is happening

This commit is contained in:
2025-12-20 14:55:49 +01:00
parent 1857f2fbc6
commit 19450f0bf7
4 changed files with 16 additions and 14 deletions

View File

@@ -5,6 +5,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
initialButton,
onButtonClick,
navigation,
disabled,
}: {
buttons: T;
initialButton: keyof T;
@@ -19,6 +20,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
horizontalMode?: "navigate" | "preview";
}
>;
disabled?: Ref<boolean>;
}) => {
const { state: modalState } = useConfirmationModal();
@@ -28,7 +30,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
const nextButton = ref<keyof T | undefined>();
useScreenClick((x: number, y: number) => {
if (modalState.value.isOpen) return;
if (modalState.value.isOpen || disabled?.value) return;
for (const [buttonName, config] of Object.entries(buttons) as [
keyof T,
@@ -56,7 +58,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
});
useKeyDown((key) => {
if (modalState.value.isOpen) return;
if (modalState.value.isOpen || disabled?.value) return;
const currentButton = selectedButton.value as keyof T;
const currentNav = navigation[currentButton];