From 493a659ed43c98349933ac2b10494367689dbb22 Mon Sep 17 00:00:00 2001 From: Dorian Date: Thu, 26 Mar 2026 21:29:14 +0000 Subject: [PATCH] fix: TS2532 undefined check in controller nav Enter handler Co-Authored-By: Claude Opus 4.6 (1M context) --- neode-ui/src/composables/useControllerNav.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neode-ui/src/composables/useControllerNav.ts b/neode-ui/src/composables/useControllerNav.ts index 1b6d05ab..60842524 100644 --- a/neode-ui/src/composables/useControllerNav.ts +++ b/neode-ui/src/composables/useControllerNav.ts @@ -155,9 +155,10 @@ export function useControllerNav(containerRef?: { value: HTMLElement | null }) { const root = containerRef?.value ?? document const all = getFocusableElements(root) const idx = all.indexOf(target as HTMLElement) - if (idx >= 0 && idx < all.length - 1) { - all[idx + 1].focus() - all[idx + 1].scrollIntoView({ block: 'nearest', behavior: 'smooth' }) + const next = idx >= 0 ? all[idx + 1] : undefined + if (next) { + next.focus() + next.scrollIntoView({ block: 'nearest', behavior: 'smooth' }) } return }