Fix scroll behavior for inline feedback messages#1787
Merged
Conversation
|
Member
Author
de1987
approved these changes
Nov 11, 2025
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.




Jira Issue: https://issues.redhat.com/browse/AAP-44636
Assisted-by: Claude code
Description
When users clicked thumbs up/down on previous messages in the chatbot, the view would auto-scroll to the bottom instead of staying anchored on the message being rated. This caused the "Thank you for your feedback!" confirmation message to appear off-screen, disrupting the user experience.
Solution
Fixed the scroll behavior by implementing a two-part solution:
Modified the useEffect hook to only trigger auto-scroll when the scrollToHere flag is explicitly set on the last message, preventing unwanted scrolling when feedback messages are added inline.
Updated the addMessage function to only set the scrollToHere flag when messages are appended to the end, not when they're inserted inline using the addAfter parameter (which is used for feedback messages).
Added comprehensive unit tests to verify:
Testing
All existing tests pass (41 tests in aap_chatbot, 39 tests in ansible_ai_connect_chatbot), plus 2 new tests per implementation verifying the scroll fix.
Production deployment