Skip to content

fix: restore chat input focus after response completes - #217

Open
felores wants to merge 1 commit into
stephengpope:mainfrom
felores:fix/chat-input-focus-v2
Open

fix: restore chat input focus after response completes#217
felores wants to merge 1 commit into
stephengpope:mainfrom
felores:fix/chat-input-focus-v2

Conversation

@felores

@felores felores commented Mar 13, 2026

Copy link
Copy Markdown

Summary

  • Textarea loses focus when the AI finishes streaming because the Chat component swaps between a loading layout and the full ChatInput at different DOM positions
  • Adds a useEffect that re-focuses the textarea 100ms after streaming ends, giving the layout swap time to settle

Test plan

  • Send a message and verify the textarea regains focus after the response completes
  • Verify focus is not stolen during streaming
  • Verify Shift+Enter still works for newlines

Tested on live deployment at bot.markenetica.com.

🤖 Generated with Claude Code

The textarea loses focus when the AI finishes streaming because the Chat
component swaps between a loading layout and the full ChatInput at
different DOM positions. A useEffect re-focuses the textarea 100ms after
streaming ends, giving the layout swap time to settle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant