From b4b38af4ab5a8494e18818cd28deb5bc71935fdc Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Thu, 12 Feb 2026 01:07:33 +0100 Subject: [PATCH] fix(utils): wrong useButtonNavigation last handling --- app/composables/useButtonNavigation.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/app/composables/useButtonNavigation.ts b/app/composables/useButtonNavigation.ts index c5f456c..3c0d7bc 100644 --- a/app/composables/useButtonNavigation.ts +++ b/app/composables/useButtonNavigation.ts @@ -268,9 +268,16 @@ export const useButtonNavigation = >({ if (nextButton.value) { targetButton = nextButton.value; } else { - const leftConfig = getNavigationTarget(currentNav.left); - const rightConfig = getNavigationTarget(currentNav.right); - targetButton = leftConfig?.target ?? rightConfig?.target; + for (const [button, nav] of Object.entries(navigation) as [ + Entry, + (typeof navigation)[Entry], + ][]) { + const downConfig = getNavigationTarget(nav.down); + if (downConfig?.target === currentButton) { + targetButton = button; + break; + } + } } } else { const targetNav = navigation[upConfig.target]; @@ -292,9 +299,16 @@ export const useButtonNavigation = >({ if (nextButton.value) { targetButton = nextButton.value; } else { - const leftConfig = getNavigationTarget(currentNav.left); - const rightConfig = getNavigationTarget(currentNav.right); - targetButton = leftConfig?.target ?? rightConfig?.target; + for (const [button, nav] of Object.entries(navigation) as [ + Entry, + (typeof navigation)[Entry], + ][]) { + const upConfig = getNavigationTarget(nav.up); + if (upConfig?.target === currentButton) { + targetButton = button; + break; + } + } } } else { const targetNav = navigation[downConfig.target];