fix(component): stop renaming modal propagation & input auto focus (#7653)

close AF-1125
This commit is contained in:
CatsJuice
2024-07-31 02:26:30 +00:00
parent c1b26473a9
commit 12a2f929f8
2 changed files with 6 additions and 1 deletions

View File

@@ -58,7 +58,11 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
const inputRef = useRef<HTMLInputElement | null>(null);
useLayoutEffect(() => {
if (inputRef.current && (autoFocus || autoSelect)) {
inputRef.current?.focus();
// to avoid clicking on something focusable(e.g MenuItem),
// then the input will not be focused
setTimeout(() => {
inputRef.current?.focus();
}, 0);
if (autoSelect) {
inputRef.current?.select();
}