fix(lightspeed): fixed jump buttons location issue#2746
fix(lightspeed): fixed jump buttons location issue#2746ciiay wants to merge 1 commit intoredhat-developer:mainfrom
Conversation
Signed-off-by: Yi Cai <yicai@redhat.com>
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Changed Packages
|
Review Summary by QodoFix jump buttons location and visibility in Lightspeed chat
WalkthroughsDescription• Fixed jump buttons positioning and visibility in chat interface • Added overflow detection for chat content scroll container • Conditionally show jump buttons only when content overflows • Implemented ResizeObserver and MutationObserver for dynamic overflow tracking Diagramflowchart LR
A["Chat Content"] --> B["Overflow Detection"]
B --> C["hasChatContentOverflow State"]
C --> D["Jump Buttons Visibility"]
D --> E["Centered & Hidden by Default"]
D --> F["Visible When Overflow Detected"]
File Changes1. workspaces/lightspeed/plugins/lightspeed/src/components/LightSpeedChat.tsx
|
Code Review by Qodo
|
|
| const getScrollTarget = () => | ||
| (scrollContainer.querySelector( | ||
| '.pf-chatbot__messagebox', | ||
| ) as HTMLElement | null) ?? scrollContainer; | ||
|
|
||
| const updateOverflow = () => { | ||
| const scrollTarget = getScrollTarget(); | ||
| setHasChatContentOverflow( | ||
| scrollTarget.scrollHeight > scrollTarget.clientHeight + 1, | ||
| ); |
There was a problem hiding this comment.
1. Wrong overflow target 🐞 Bug ≡ Correctness
The new overflow detection always prefers .pf-chatbot__messagebox when present, but in “new chat” mode the MessageBox is configured to auto-size with overflow: visible, making the outer ChatbotContentScroll div the real scroll container. This can leave hasChatContentOverflow false and keep .pf-chatbot__jump hidden even while the user is scrolling overflowing chat content.
Agent Prompt
## Issue description
`hasChatContentOverflow` is computed from `.pf-chatbot__messagebox` whenever it exists, but in “new chat” mode the MessageBox is not the scrolling element (it is auto-height with `overflow: visible`). This causes jump buttons to remain hidden even when the *actual* scroll container (`contentScrollRef`) overflows.
## Issue Context
- New chat mode uses `messageBoxAutoHeight` specifically so **ChatbotContent is the scroll container**.
- Jump buttons are hidden by default and only shown when `hasChatContentOverflow` is true.
## Fix approach
Update overflow detection to use the element that actually scrolls:
- Prefer `.pf-chatbot__messagebox` **only when it is the scrollable container** (e.g., `overflowY` is `auto|scroll` and/or it has internal overflow), otherwise fall back to `scrollContainer`.
- Alternatively, compute overflow for both elements and set `hasChatContentOverflow` true if *either* one overflows.
## Fix Focus Areas
- workspaces/lightspeed/plugins/lightspeed/src/components/LightSpeedChat.tsx[968-978]
- workspaces/lightspeed/plugins/lightspeed/src/components/LightSpeedChat.tsx[304-323]
- workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatBox.tsx[88-99]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Hey, I just made a Pull Request!
For RHBUGS-2898
✔️ Checklist
screen recording
rhdhbugs_2898.mp4