feat: auto focus to inputbox (issue: #243) (pr: #249)

* Put the cursor back to input area after the answer generated

* move inputbox focus to lonely useEffect

---------

Co-authored-by: Jikai Xu <“jikai.xu@insigniafinancial.com.au”>
Co-authored-by: josc146 <josStorer@outlook.com>
This commit is contained in:
snoopy83
2023-04-20 23:20:51 +10:00
committed by GitHub
parent 2d0d9164c6
commit c8680a4bf1
+4
View File
@@ -12,6 +12,10 @@ export function InputBox({ onSubmit, enabled }) {
updateRefHeight(inputRef)
})
useEffect(() => {
if (enabled) inputRef.current.focus()
}, [enabled])
const onKeyDown = (e) => {
e.stopPropagation()
if (e.keyCode === 13 && e.shiftKey === false) {