-
Notifications
You must be signed in to change notification settings - Fork 293
Open
Description
Bug: Webchat input loses focus after sending a message
Description
After sending a message in the webchat interface, the cursor/focus does not automatically return to the input field. The user must manually click/tap the input to continue typing.
Expected Behavior
After sending a message, focus should return to the text input field so the user can immediately type their next message without additional interaction.
Actual Behavior
- User types a message and presses Enter (or clicks Send)
- Message is sent successfully
- Focus remains on the page body or shifts elsewhere
- User must click/tap the input field again to continue typing
Environment
- Spacebot version: 0.3.3
- Browser: Chrome 45.0.7632.119
- OS: Windows 11
- Device: Desktop
Steps to Reproduce
- Navigate to an agent's chat page (e.g.,
/agents/main/chat) - Click/focus the message input field
- Type a message
- Press Enter or click the Send button
- Observe that the input field is no longer focused
Proposed Fix
After the message is sent (and the input is cleared), call inputRef.focus() to restore focus to the textarea/input element. This is a common pattern in chat UIs.
const handleSend = async () => {
if (!message.trim()) return;
await sendMessage(message);
setMessage('');
inputRef.current?.focus();
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels