fix(web/style): 鼠标 hover post-list 时滚动条占位导致内容左右抖动#109
Merged
Conversation
PR #93 把 #post-list 的 scrollbar 改成 hover 时显示,通过 hover 切换 scrollbar-width: none → auto 实现。但这个切换在 Firefox 和 Chromium 都会真正占走 ~10px 布局宽度,鼠标移进 post-list 内容左移 10px、移走 再右移回来,肉眼可见的抖动。 修法:scrollbar-gutter: stable 永远预留 gutter,bar 仍然只在 hover 时画。视觉上跟之前完全一致(默认空、hover 出现),但布局宽度恒定, 鼠标进出零 reflow。 (原本是跟 PR #106 keyed-diff 一起修的,但 #106 在 scrollbar 改动 push 上去之前就 merge 了,所以这里单独再开一个 PR。)
🤖 bot-review (comment-only · phase 1)Diff: Red-line checks:
Phase 2: auto-approve + auto-merge fire only when red-lines are clean, author is internal, and no needs-human path is touched. Block with |
This was referenced Jun 29, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Jun 29, 2026
PR #109 用 scrollbar-gutter: stable 想保留 gutter,但 CSS 规范规定 gutter 在 scrollbar-width: none 时是 no-op,所以那行修改实际上根本 没生效,hover 切到 auto 仍然会真占走 ~10px。Scott 反馈刷新后还在抖 就是这个原因。 正确做法:让 scrollbar 始终挂载且宽度固定,默认 thumb / track 全透明, hover 时把 thumb 上色。视觉上跟之前的 Slack-style hover-reveal 完全一样 (默认看不到、hover 出现),但布局宽度恒定,鼠标进出零 reflow。 - WebKit/Chromium/Safari:::-webkit-scrollbar 固定 width: 10px, ::-webkit-scrollbar-thumb 默认 transparent,hover 时上色。 - Firefox:scrollbar-width: thin + scrollbar-color: transparent transparent 默认,hover 时把 thumb 颜色切到 rgba(0,0,0,0.25)。 - 加 0.15s transition 让出现/消失更柔和。 SW 已经在 v2 = network-first,下次硬刷新一次直接生效。 Co-authored-by: judy <judy@symbolstar.local>
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.
问题
鼠标移进 thread message 页面时右侧滚动条出现占位,鼠标移走占位消失,肉眼可见内容左右抖动。
根因
PR #93(7a804fd「scrollbar on hover」)把
#post-list的 scrollbar 改成 hover 时显示,靠 hover 切换scrollbar-width: none → auto实现。这个切换在 Firefox 和 Chromium 都会真正占走 ~10px 布局宽度:修复
永远预留 gutter,bar 仍然只在 hover 时画。视觉上跟之前完全一致(默认空、hover 出现),但布局宽度恒定,鼠标进出零 reflow。
关联
原本是想跟 PR #106(keyed-diff renderPosts)一起修,但 #106 已经在 scrollbar 那个 commit push 上去之前 merge 了,所以单独开一个 PR。
验证