diff --git a/neode-ui/src/composables/useControllerNav.ts b/neode-ui/src/composables/useControllerNav.ts index 90fa4e29..c0091c85 100644 --- a/neode-ui/src/composables/useControllerNav.ts +++ b/neode-ui/src/composables/useControllerNav.ts @@ -415,12 +415,19 @@ export function useControllerNav(containerRef?: { value: HTMLElement | null }) { if (dest) { focusEl(dest) } else { - // Containers may not be rendered yet (async load after route change) - // Retry after a short delay - setTimeout(() => { + // Containers not rendered yet (route transition / animation in progress) + // Poll until they appear, up to 1s + let attempts = 0 + const poll = setInterval(() => { + attempts++ const retryContainers = getContainers() - if (retryContainers[0]) focusEl(retryContainers[0]) - }, 200) + if (retryContainers[0]) { + clearInterval(poll) + focusEl(retryContainers[0]) + } else if (attempts >= 10) { + clearInterval(poll) + } + }, 100) } return }