Defer TextInput autofocus past portal move

Fixes autofocus in New Repo modal text input.
This commit is contained in:
Rūdolfs Ošiņš
2026-05-21 17:58:02 +02:00
parent 15763d7c6e
commit d79bbf3a4d
+5 -2
View File
@@ -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();