diff --git a/FRONTEND/src/components/BottomToolBar.tsx b/FRONTEND/src/components/BottomToolBar.tsx index ac48571..01b1c3d 100644 --- a/FRONTEND/src/components/BottomToolBar.tsx +++ b/FRONTEND/src/components/BottomToolBar.tsx @@ -11,7 +11,7 @@ import { Tabs, Text, } from "@mantine/core"; -import { useMemo, useState } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import classes from "./Component.module.css"; import type { IScenario, TLine, TStation } from "../untils/types"; import type { Socket } from "socket.io-client"; @@ -64,9 +64,16 @@ const BottomToolBar = ({ : null; }, []); const [valueInput, setValueInput] = useState(""); + const inputRef = useRef(null); // const [activeTabBottom, setActiveTabBottom] = useState("command"); // const [isExpand, setIsExpand] = useState(true); + useEffect(() => { + if (selectedLines?.length > 1 && inputRef?.current) { + inputRef?.current?.focus(); + } + }, [selectedLines?.length]); + return (