DeepTutor
DeepTutor copied to clipboard
fix: preserve chat input focus after sending
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-filesand 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.tsxnpm run test:node(258 passed)npm run lint(0 errors; 59 pre-existing warnings)npm run buildgit 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.