Scroll chat input into view when focused
parent
6687e89e1c
commit
1ff185fe9f
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "chat",
|
||||
"version": "0.1.10",
|
||||
"version": "0.1.11",
|
||||
"main": "./src/index.tsx",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -84,6 +84,9 @@ export function UserInput() {
|
|||
},
|
||||
[draft]
|
||||
);
|
||||
const handleFocus = useCallback(() => {
|
||||
builtChatInput.current?.scrollIntoView({ behavior: "smooth" });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<form ref={form} className="UserInput" onSubmit={handleSendMessage}>
|
||||
|
@ -118,6 +121,7 @@ export function UserInput() {
|
|||
rows={1}
|
||||
onChange={handleChange}
|
||||
onKeyUp={handleKeyUp}
|
||||
onFocus={handleFocus}
|
||||
placeholder="Message"
|
||||
autoComplete="off"
|
||||
value={draft}
|
||||
|
|
Loading…
Reference in New Issue