spacedriveapp / spacedriveapp/spacebot

Return focus to input field after sending message via chat portal

Open
#451 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.4k
Forks
367
PR merge metrics
No merged PRs in 30d

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
  1. Navigate to an agent's chat page (e.g., /agents/main/chat)
  2. Click/focus the message input field
  3. Type a message
  4. Press Enter or click the Send button
  5. 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();
};

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the /agents/main/chat entry point and locate the message input and send handler described in the issue. Verify the behavior for both Enter and the Send button, and consider the issue complete when the cleared input is focused again after a successful send.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.