Describe the bug
Every time a user message is sent, the chat view forcibly
smooth-scrolls
to the bottom — regardless of the user's current scroll position.
This makes it impossible to stay at a specific point in the
conversation
while waiting for a response.
Root cause (identified in minified bundle)
In the chat component's useLayoutEffect, the scroll is
triggered
whenever the last message role is "user":
constjustSentUserMsg=messages.length>0&&messages[messages.length-1].role==="user"if(contentGrew&&(isFirstLoad||wasAtBottom||justSentUserMsg)){container.scrollTo({top: scrollHeight,behavior: "smooth"})}The justSentUserMsg condition bypasses the wasAtBottom guard,
so scroll always fires on send — even if the user has scrolled
up.
Expected behavior
Only scroll to bottom if the user was already near the bottom
(wasAtBottom === true) before sending. Sending a message should
not override a deliberate scroll position.
Suggested fix
Remove justSentUserMsg from the OR condition, or gate it behind
wasAtBottom:
if (contentGrew && (isFirstLoad || wasAtBottom)) { container.scrollTo({ top: scrollHeight, behavior: "smooth" }) }
Environment
- agentapi version: 0.12.2
- Agent: claude
Describe the bug
Every time a user message is sent, the chat view forcibly
smooth-scrolls
to the bottom — regardless of the user's current scroll position.
This makes it impossible to stay at a specific point in the
conversation
while waiting for a response.
Root cause (identified in minified bundle)
In the chat component's
useLayoutEffect, the scroll istriggered
whenever the last message role is
"user":The justSentUserMsg condition bypasses the wasAtBottom guard,
so scroll always fires on send — even if the user has scrolled
up.
Expected behavior
Only scroll to bottom if the user was already near the bottom
(wasAtBottom === true) before sending. Sending a message should
not override a deliberate scroll position.
Suggested fix
Remove justSentUserMsg from the OR condition, or gate it behind
wasAtBottom:
Environment