mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-30 16:50:47 +08:00
Defer TextInput autofocus past portal move
Fixes autofocus in New Repo modal text input.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user