[fix] st.chat_input collapses after submit#12132
Merged
Merged
Conversation
Contributor
🎉 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) |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
The snapshot naming follows the recommended convention 'st_command-test_description' as specified in the coding guidelines.
sfc-gh-lwilby
pushed a commit
that referenced
this pull request
Aug 12, 2025
## 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.