From d79bbf3a4d280b944eb77a6e8afe0a1361afe083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Thu, 21 May 2026 17:49:56 +0200 Subject: [PATCH] Defer TextInput autofocus past portal move Fixes autofocus in New Repo modal text input. --- src/components/TextInput.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/TextInput.svelte b/src/components/TextInput.svelte index acac68632..ec36dba02 100644 --- a/src/components/TextInput.svelte +++ b/src/components/TextInput.svelte @@ -50,8 +50,11 @@ return; } if (autofocus) { - // We set preventScroll to true for Svelte animations to work. - inputElement.focus({ preventScroll: true }); + // Defer focus past the next frame so it survives parent + // actions (like portal moves) that detach the node on mount. + requestAnimationFrame(() => { + inputElement?.focus({ preventScroll: true }); + }); } if (autoselect) { inputElement.select();