feat: Add focus to input when chat menu is opened

Add focus to input when chat menu is opened to improve user experience. This commit modifies the onChange function in ChatPanel.tsx to set focus to the input field when the menu is opened.
This commit is contained in:
Rankin Zheng 2023-05-10 20:27:43 +08:00
parent cfe6a4fa50
commit dd35eff4b4

View File

@ -443,7 +443,10 @@ const chatPanel = () => {
shadow="xs"
width={scrollViewport.current?.clientWidth}
opened={menuOpend}
onChange={setMenuOpend}
onChange={() => {
setMenuOpend(!menuOpend);
inputRef.current.focus();
}}
onClose={() => setMenuType('')}
onOpen={() => menuType !== '' ? setMenuOpend(true) : setMenuOpend(false)}
returnFocus={true}>