DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

fix: preserve chat input focus after sending

Open dongyu-will opened this issue 4 months ago • 0 comments

Description

Restores focus to the main chat composer after a message is sent.

The composer previously cleared its text but did not restore focus after the send button took focus or the empty-state composer transitioned into the conversation layout. The textarea is now focused on the next animation frame after a successful send, so users can continue typing immediately and retain that focus when returning to the browser tab.

Related Issues

  • Fixes #697

Module(s) Affected

  • [ ] agents
  • [ ] api
  • [ ] config
  • [ ] core
  • [ ] knowledge
  • [ ] logging
  • [ ] services
  • [ ] tools
  • [ ] utils
  • [x] web (Frontend)
  • [ ] docs (Documentation)
  • [ ] scripts
  • [ ] tests
  • [ ] Other: ...

Checklist

  • [x] I have read and followed the contribution guidelines.
  • [x] My code follows the project's coding standards.
  • [ ] I have run pre-commit run --all-files and fixed any issues.
  • [ ] I have added relevant tests for my changes.
  • [x] I have updated the documentation (if necessary).
  • [x] My changes do not introduce any new security vulnerabilities.

Validation

  • npx eslint components/chat/home/ChatComposer.tsx
  • npm run test:node (258 passed)
  • npm run lint (0 errors; 59 pre-existing warnings)
  • npm run build
  • git diff --check
  • Local browser: send a chat message, switch to another tab and return; the composer remains focused.

Additional Notes

The local pre-commit run passed every applicable hook except its bundled Prettier 4 alpha hook, which reformats existing untouched code in this file. That unrelated reformat was not included in this PR.

dongyu-will avatar Jul 28 '26 12:07 dongyu-will