Open
Conversation
`cv-ready` CSS 类触发 `content-visibility: auto` 的切换,当流式结束时重新应用该类会导致布局重算和滚动位置微移(1px),使得 StickToBottom 错误地认为用户主动滚动而解除粘性,导致新消息到达时不自动滚动到底部。现在始终应用 cv-ready 以保持稳定的尺寸缓存,避免重复的布局抖动。
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.
Summary
修复了 Chat 和 Agent 模式中,发送消息后会向上滚动的 UI Bug。
问题分析
cv-readyCSS 类控制content-visibility: auto优化的启用。当流式生成停止时,该类被重新应用,导致浏览器重新计算消息尺寸。即使使用contain-intrinsic-size: auto缓存尺寸,class 的反复切换也会触发布局抖动,scroll 位置微移 1px 足以让StickToBottom误认为用户主动滚动而解除粘性,后续新消息不再自动滚动到底部。解决方案
移除对
streaming状态的依赖,始终应用cv-ready类。由于流式消息元素没有data-message-id,不受content-visibility: auto影响,而历史消息的尺寸缓存保持稳定,避免重复的布局重算。修改文件
apps/electron/src/renderer/components/chat/ChatMessages.tsx(L294)apps/electron/src/renderer/components/agent/AgentMessages.tsx(L624)