diff --git a/packages/frontend/src/components/terminal/CommandInput.tsx b/packages/frontend/src/components/terminal/CommandInput.tsx index 703fdfd0..d7ad5a3b 100644 --- a/packages/frontend/src/components/terminal/CommandInput.tsx +++ b/packages/frontend/src/components/terminal/CommandInput.tsx @@ -6,6 +6,8 @@ import { useRef, } from "react"; +import { focusRef, scrollIntoViewRef } from "../../utils/refObject"; + import Prompt from "./Prompt"; import * as styles from "./Terminal.css"; @@ -27,10 +29,10 @@ const CommandInput = forwardRef( ref, () => ({ focus(options) { - inputRef.current?.focus(options); + focusRef(inputRef, options); }, scrollIntoView(arg) { - inputRef.current?.scrollIntoView(arg); + scrollIntoViewRef(inputRef, arg); }, }), [], @@ -59,7 +61,7 @@ const CommandInput = forwardRef( }; const handleClick = () => { - inputRef.current?.focus(); + focusRef(inputRef); }; return (