mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(component): stop renaming modal propagation & input auto focus (#7653)
close AF-1125
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user