-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] st.chat_input collapses after submit #12132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] st.chat_input collapses after submit #12132
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
✅ PR preview is ready!
|
lukasmasuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a regression in st.chat_input where the input field wasn't collapsing back to its compact state after message submission. The fix restores the auto-expand functionality by re-introducing logic to reset the textarea height after form submission.
Key changes:
- Extended the
useTextInputAutoExpandhook to provide aclearScrollHeightfunction - Added a call to reset the scroll height in the ChatInput component's submit handler
- Added comprehensive e2e tests to verify the height reset behavior
Reviewed Changes
Copilot reviewed 3 out of 12 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
frontend/lib/src/hooks/useTextInputAutoExpand.ts |
Added clearScrollHeight function to reset textarea scroll height to 0 |
frontend/lib/src/components/widgets/ChatInput/ChatInput.tsx |
Added call to clearScrollHeight() in submit handler to reset input height |
e2e_playwright/st_chat_input_test.py |
Added e2e test to verify chat input height resets properly after submission |
| chat_input = app.get_by_test_id("stChatInput").nth(0) | ||
| chat_input_area = chat_input.locator("textarea") | ||
|
|
||
| assert_snapshot(chat_input, name="st_chat_input-initial_compact_state") |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The snapshot naming follows the recommended convention 'st_command-test_description' as specified in the coding guidelines.
## Describe your changes This PR addresses a regression where the logic for resetting the height of `st.chat_input` after submission was broken by some refactoring. It re-introduces the code to reset the scroll height to 0 after submit. The PR also adds an e2e test for the user interaction. <!-- If it's a visual change, please include a screenshot or video! --> ## GitHub Issue Link (if applicable) Fixes #12079 ## Testing Plan - E2E Tests ✅ --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Describe your changes
This PR addresses a regression where the logic for resetting the height of
st.chat_inputafter submission was broken by some refactoring. It re-introduces the code to reset the scroll height to 0 after submit. The PR also adds an e2e test for the user interaction.GitHub Issue Link (if applicable)
Fixes #12079
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.