fix: TS2532 undefined check in controller nav Enter handler

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian 2026-03-26 21:29:14 +00:00
parent e4bdc775e4
commit 493a659ed4

View File

@ -155,9 +155,10 @@ export function useControllerNav(containerRef?: { value: HTMLElement | null }) {
const root = containerRef?.value ?? document const root = containerRef?.value ?? document
const all = getFocusableElements(root) const all = getFocusableElements(root)
const idx = all.indexOf(target as HTMLElement) const idx = all.indexOf(target as HTMLElement)
if (idx >= 0 && idx < all.length - 1) { const next = idx >= 0 ? all[idx + 1] : undefined
all[idx + 1].focus() if (next) {
all[idx + 1].scrollIntoView({ block: 'nearest', behavior: 'smooth' }) next.focus()
next.scrollIntoView({ block: 'nearest', behavior: 'smooth' })
} }
return return
} }