fix(ui): modal form input focus problem

This commit is contained in:
Fu Diwei
2025-01-18 18:24:42 +08:00
parent d5e4ea385d
commit 2171faa330
3 changed files with 25 additions and 15 deletions

View File

@@ -52,7 +52,7 @@ const MultipleInput = ({
draft.push("");
});
setValue(newValue);
setTimeout(() => itemRefs.current[newValue.length - 1]?.focus(), 0);
setTimeout(() => itemRefs.current[newValue.length - 1]?.focus(), 1);
onValueCreate?.(newValue.length - 1);
};
@@ -110,7 +110,7 @@ const MultipleInput = ({
draft.splice(index + 1, 0, "");
});
setValue(newValue);
setTimeout(() => itemRefs.current[index + 1]?.focus(), 0);
setTimeout(() => itemRefs.current[index + 1]?.focus(), 1);
onValueCreate?.(index + 1);
};