Focus input after chat comes in

This commit is contained in:
Nate Kelley 2025-07-13 08:10:15 -06:00
parent c0745bc0c2
commit fa42592b95
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import React, { type ChangeEvent, useMemo, useRef, useState } from 'react';
import React, { type ChangeEvent, useEffect, useMemo, useRef, useState } from 'react';
import { InputTextAreaButton } from '@/components/ui/inputs/InputTextAreaButton';
import { useMemoizedFn } from '@/hooks';
import { cn } from '@/lib/classMerge';
@ -32,6 +32,14 @@ export const ChatInput: React.FC = React.memo(() => {
setInputValue(e.target.value);
});
useEffect(() => {
if (hasChat) {
requestAnimationFrame(() => {
textAreaRef.current?.focus();
});
}
}, [hasChat, textAreaRef]);
return (
<div
className={cn(