Repository navigation
fix(web-shell): clear scrollbar-gutter in collapsed sidebar rail (#12453) - #12652
Conversation
…nLM#12453) Resubmission of QwenLM#12454 (closed: commits qwen-dist-backup-* junk). Single-line source change per maintainer guidance: .body reserves scrollbar-gutter: stable, which keeps a scrollbar-width gutter in the collapsed rail where no scrollbar can appear, offsetting the newTaskNav icon from its siblings. Clear it in .collapsed .body.
…12652 R1) Pair scrollbar-gutter: auto with scrollbar-width: none plus a ::-webkit-scrollbar reset: the collapsed rail's content box is 32px, and once the session list overflows a visible scrollbar would re-take the 8px (per globals.css) and re-create the exact icon offset this PR fixes — plus overflow-x: hidden would clip the buttons. Non-blocking gap called out in the PR triage; closed here.
pomelo-nwu
left a comment
There was a problem hiding this comment.
Reviewed the current CSS diff. Clearing the reserved gutter and hiding the scrollbar only in the collapsed rail addresses the icon offset while keeping the expanded sidebar rules intact. The Firefox and WebKit scrollbar paths are both covered. I did not reproduce the layout visually locally; I found no further code issue in this small change.
Maintainer verification — real
|
| Platform · browser | Scrollbars | main: reserved → .body icon offset |
PR head | 460 px, overflowing and scrolled (main → head) |
|---|---|---|---|---|
| Windows Server 2022 · Edge 152.0.4191.66 | classic | 10 px → −5.0 px | 0 → 0 | 10 px / −5.0 → 0 / 0 |
| Windows Server 2022 · Chrome 153.0.8010.53 | classic | 10 px → −5.0 px | 0 → 0 | 10 px / −5.0 → 0 / 0 |
| Ubuntu 24.04 · Chrome 153.0.8010.52 | classic | 10 px → −5.0 px | 0 → 0 | 10 px / −5.0 → 0 / 0 |
| Ubuntu 24.04 · Playwright Chromium 149, default launch args | classic, space reserved but unpainted | 10 px → −5.0 px | 0 → 0 | 10 px / −5.0 → 0 / 0 |
| macOS · Chromium 149, scroll bars = Always | classic | 11 px → −5.5 px | 0 → 0 | 11 px / −5.5 → 0 / 0 |
| macOS · Chrome 153 / Chromium 149, default | overlay | 0 → 0 | 0 → 0 | pixel-identical across arms |
| Ubuntu · Firefox 151, WebKit 26.5 | overlay on this runner | not captured¹ | 0 → 0 | head scrolls 0→40 px |
On every classic-scrollbar row, all five icons in .body share the same offset: Plugins, Channels, Scheduled Tasks, Goals, and the Project session switcher. The brand logo, New task, and the footer stay at x = 27.5 px. Scrolling works in every arm (scrollTop goes from 0 to 40 px). The expanded sidebar, both before collapsing and after re-expanding, is pixel-identical across arms on every platform where both arms were captured, and .body keeps its gutter in both arms (10 px or 11 px with classic scrollbars). The only pixel difference in any expanded capture is a blinking composer caret at x = 293, which is outside the 260 px sidebar.
¹ On Linux, the Firefox and WebKit base-arm runs hit a harness navigation race (page.goto … interrupted by another navigation). I didn't re-run them: both engines render overlay scrollbars on that runner (0 px reserved even in the expanded sidebar), so they couldn't tell the arms apart.
Which declaration is load-bearing
I made mutation arms by editing the built CSS in place and served each from its own daemon: Chromium 149, classic scrollbars.
| Arm | .collapsed .body keeps |
900 px | 460 px (overflow) |
|---|---|---|---|
main |
none of the three | 11 px, −5.5 px | 11 px, −5.5 px |
m1 = 1st commit d2471f5 |
scrollbar-gutter: auto |
0 | 11 px, −5.5 px |
| m4 | gutter + ::-webkit-scrollbar { display: none } |
0 | 11 px, −5.5 px |
| m2 | scrollbar-width: none + webkit rule |
0 | 0 |
| m3 | gutter + scrollbar-width: none |
0 | 0 |
| PR head | all three | 0 | 0 |
scrollbar-width: noneis the declaration that does the work. The R1 follow-up commit560f8b2was necessary. With the first commit alone, the 11 px scrollbar and the offset come back as soon as the rail overflows (third panel of the macOS figure).- The webkit rule has no effect in Chromium. The global
*rule already setsscrollbar-width: thin, and Chromium ≥ 121 ignores::-webkit-scrollbaronce the standard property is set. - The gutter reset is redundant in Chromium. Once
scrollbar-width: noneapplies, no gutter is reserved without it either. - Both of those are harmless, and they help engines without
scrollbar-width(Safari < 18.2). Nothing to change.
Notes (non-blocking)
-
No test pins the fix. The 509 tests in
client/components/sidebar/andvisual-capture-contracts.test.tspass on the head. They also all pass with the CSS reverted tomain.WebShellSidebar.css.test.tsalready parses this stylesheet with postcss, so adding a pin is cheap. The candidate below is prettier-clean. Mutated at source level, it fails onmain, m1 and m4 and passes on head, m2 and m3, which matches the browser results above exactly.describe('WebShellSidebar collapsed rail stylesheet', () => { it('keeps a layout-taking scrollbar out of the collapsed rail (#12453)', () => { // `.body` reserves `scrollbar-gutter: stable`; in the 32px collapsed rail // that gutter, or the scrollbar itself once the rail overflows, shifts // every icon inside `.body` off the New task icon's axis. const decls = new Map<string, string>(); parseOnce().walkRules('.collapsed .body', (rule) => { rule.walkDecls((decl) => decls.set(decl.prop, decl.value)); }); expect(decls.get('scrollbar-width')).toBe('none'); }); });
-
The visuals lane can see this bug; it just has no scenario for it. I ran the lane's own browser setup: Playwright's bundled headless Chromium on Ubuntu with default launch args, including
--hide-scrollbars. Onmainit still reserves 10 px and offsets the icons by 5 px. The scrollbar isn't painted, but its width is reserved. So the follow-up triage suggested, adding a collapsed-rail capture toscreenshots.spec.ts, would catch a regression in CI. On macOS the lane would stay blind, because overlay scrollbars reserve nothing there. -
The offset is 5–5.5 px, not the ≈4 px (or 7–8 px) estimated in the thread. Because
scrollbar-width: thinis set globally, Chromium draws its native thin scrollbar: 10 px on Windows and Linux, 11 px on macOS. The::-webkit-scrollbar { width: 8px }rule is ignored. -
Discoverability trade-off (fine). At 460 px the Project/session-switcher icon starts below the fold. On
main, a classic scrollbar hints that the rail scrolls; on the head nothing does, which is what macOS overlay users already get. Wheel and trackpad scrolling still work. Optional nit: the new CSS comment says "the moment the session list overflows", but in the collapsed rail.bodyonly holds the primary nav and the session-switcher trigger (the list itself is in a popover). -
Pre-existing, out of scope, identical in both arms. The collapsed footer is 245 px tall and opaque, but
.collapsed .bodyonly reservesmargin-bottom: 220px. So the footer covers the last 17 px of the scroll port (footer top 651 vs. port bottom 668 at 900 px). When the rail overflows, the last icon stays half-hidden even when scrolled to the end. Worth its own issue if short windows matter.
Other checks
prettier --checkon the file is clean.vitest run client/components/sidebar/ client/visual-capture-contracts.test.ts: 27 files, 509 tests pass.- PR CI on
8b39a69: Lint & Static, Desktop Shell (ubuntu + windows), no-AK integration and web-shell visuals are green. The earlier Lint failure on560f8b2was the lint-gate freshness step, cleared by the main merge.Test (ubuntu-latest)was still running when I posted this.
中文说明
维护者验证 —— 在 Windows / Linux / macOS 上用真实 qwen serve 验证(head 8b39a69)
结论:可以合并。 在我测过的所有经典(占位式)滚动条平台上,main 会让收起态侧栏 .body 内的图标相对「新建任务」图标左偏 5–5.5 px,本 PR 把它们拉回同一条轴线。不管侧栏放得下还是溢出后滚动,结果都一样。在 overlay 滚动条的平台上,本 PR 什么也不改变;展开态侧栏两臂逐像素一致。下面的备注都不阻塞合并。
验证方法
- 两臂。 PR head
8b39a69对比它的合并父提交9cb0180(即当前origin/main),两者之间的git diff恰好只有这一个 CSS 文件。两臂都是生产构建。把资源 hash 和 CSS Module hash 规范化之后比较两份 Web Shell 构建,CSS 上唯一的语义差异就是新增的两条规则。 - 装置。 每一臂由真实的
qwen servedaemon 托管其生产版web-shell/,各自独立QWEN_HOME,挂真实工作区。Playwright 点页脚真实的 Collapse 按钮收起侧栏,然后测.body预留的行内空间(offsetWidth − clientWidth),以及每个图标中心 x 相对 New task 图标的偏移。侧栏溢出时滚动它,最后再展开侧栏。 - 视口。 1280×900(放得下)和 1280×460(内容 168 px,超过 128 px 的滚动视口,发生溢出)。
- 平台。
- Windows: GitHub 托管
windows-2022(NT 10.0.20348),在 runner 上从源码构建,用系统自带的 Edge 和 Chrome。 - Linux: GitHub 托管
ubuntu-24.04,同样从源码构建。 - macOS: 本机,通过
-AppleShowScrollBars Always参数域只对单个 Chromium 进程强制「始终显示滚动条」,没有改动任何系统设置。另外也跑了默认的 overlay 滚动条。
- Windows: GitHub 托管
结果(收起态)
| 平台 · 浏览器 | 滚动条 | main:预留 → .body 图标偏移 |
PR head | 460 px 溢出并滚动后(main → head) |
|---|---|---|---|---|
| Windows Server 2022 · Edge 152 | 经典 | 10 px → −5.0 px | 0 → 0 | 10 px / −5.0 → 0 / 0 |
| Windows Server 2022 · Chrome 153 | 经典 | 10 px → −5.0 px | 0 → 0 | 同上 |
| Ubuntu 24.04 · Chrome 153 | 经典 | 10 px → −5.0 px | 0 → 0 | 同上 |
| Ubuntu 24.04 · Playwright Chromium 149,默认启动参数 | 经典(预留宽度但不绘制) | 10 px → −5.0 px | 0 → 0 | 同上 |
| macOS · Chromium 149,滚动条 = 始终 | 经典 | 11 px → −5.5 px | 0 → 0 | 11 px / −5.5 → 0 / 0 |
| macOS · Chrome 153 / Chromium 149,默认 | overlay | 0 → 0 | 0 → 0 | 两臂逐像素一致 |
| Ubuntu · Firefox 151、WebKit 26.5 | 该 runner 上为 overlay | 未采集¹ | 0 → 0 | head 可滚动 0→40 px |
在所有经典滚动条的行里,.body 内的五个图标偏移完全相同:插件、频道、定时任务、目标,以及 Project 会话切换器。品牌 logo、新建任务和页脚都在 x = 27.5 px。每一臂都能正常滚动(scrollTop 从 0 到 40 px)。展开态侧栏(收起前和再次展开后)在所有两臂都采集到的平台上逐像素一致,.body 的 gutter 在两臂中都保留(经典滚动条下为 10 px 或 11 px)。展开态截图里唯一的像素差,是输入框里闪烁的光标(x = 293,在 260 px 侧栏之外)。
¹ Linux 上 Firefox 和 WebKit 的 base 臂遇到探针侧的导航竞态(page.goto … interrupted by another navigation),没有重跑:这两个引擎在该 runner 上都是 overlay 滚动条(连展开态都预留 0 px),本来就分辨不出两臂。
(图见上方英文部分:图 1 为 Windows Edge,图 2 为 macOS 经典滚动条,含 PR 第一个 commit 的对照。)
哪条声明在起作用
我直接在构建产物的 CSS 上做变异,每个变异臂各起一个 daemon 托管(Chromium 149,经典滚动条)。
| 臂 | .collapsed .body 保留的声明 |
900 px | 460 px(溢出) |
|---|---|---|---|
main |
三条都没有 | 11 px,−5.5 px | 11 px,−5.5 px |
m1 = 第一个 commit d2471f5 |
scrollbar-gutter: auto |
0 | 11 px,−5.5 px |
| m4 | gutter + ::-webkit-scrollbar { display: none } |
0 | 11 px,−5.5 px |
| m2 | scrollbar-width: none + webkit 规则 |
0 | 0 |
| m3 | gutter + scrollbar-width: none |
0 | 0 |
| PR head | 三条都有 | 0 | 0 |
- 起作用的是
scrollbar-width: none。 R1 追加的 commit560f8b2是必要的:只有第一个 commit 时,侧栏一溢出,11 px 滚动条和偏移就回来了(见 macOS 图第三栏)。 - webkit 规则在 Chromium 里不生效。 全局
*规则已经设置了scrollbar-width: thin,Chromium ≥ 121 在设置了标准属性后会忽略::-webkit-scrollbar。 - gutter 复位在 Chromium 里是冗余的。 只要
scrollbar-width: none生效,不加它也不会预留 gutter。 - 这两条都无害,而且对不支持
scrollbar-width的引擎(Safari < 18.2)有兜底作用。无需改动。
备注(非阻塞)
- 没有测试钉住这个修复。
client/components/sidebar/和visual-capture-contracts.test.ts的 509 条测试在 head 上全过;把 CSS 退回main后照样全过。WebShellSidebar.css.test.ts已经用 postcss 解析这份样式表,加一条钉住的测试成本很低。上面英文部分给了一个候选用例(prettier 格式干净)。在源码级变异下,它在main、m1、m4 上失败,在 head、m2、m3 上通过,与浏览器实测完全吻合。 - visuals 通道看得见这个 bug,只是缺场景。 我照该通道的浏览器配置跑了一遍:Ubuntu 上 Playwright 自带的 headless Chromium,默认启动参数(含
--hide-scrollbars)。main仍然预留 10 px、图标偏移 5 px:滚动条不绘制,但宽度照样预留。所以 triage 建议的后续工作——在screenshots.spec.ts里补一个收起态截图——能在 CI 里抓住回归。只有在 macOS 上它会失明,因为 overlay 滚动条不预留空间。 - 偏移是 5–5.5 px,不是线程里估算的 ≈4 px(或 7–8 px)。 由于全局设置了
scrollbar-width: thin,Chromium 用的是原生细滚动条:Windows 和 Linux 上 10 px,macOS 上 11 px;::-webkit-scrollbar { width: 8px }被忽略。 - 可发现性权衡(可接受)。 460 px 时,Project/会话切换器图标一开始在视口之外。
main上经典滚动条会提示侧栏可以滚动,head 上没有任何提示,这与 macOS overlay 用户本来的体验一致。滚轮和触控板滚动都正常。可选的小问题:新增的 CSS 注释写的是「会话列表溢出时」,但收起态下.body里只有主导航和会话切换器按钮(会话列表本身在弹层里)。 - 既有问题,不在本 PR 范围内,两臂完全相同。 收起态页脚高 245 px 且不透明,但
.collapsed .body只预留了margin-bottom: 220px。于是页脚盖住了滚动视口底部 17 px(900 px 时页脚顶部在 651,视口底部在 668)。侧栏溢出时,即使滚到底,最后一个图标也仍然被遮住一半。如果矮窗口场景重要,值得单开一个 issue。
其它检查
- 该文件
prettier --check干净。vitest run client/components/sidebar/ client/visual-capture-contracts.test.ts:27 个文件、509 条测试全部通过。 8b39a69上的 PR CI:Lint & Static、Desktop Shell(ubuntu + windows)、no-AK 集成测试和 web-shell visuals 全绿。之前560f8b2上的 Lint 失败出在 lint 门禁新鲜度检查,merge main 后已消除。发布本评论时Test (ubuntu-latest)仍在运行。
|
@qwen-code /triage |
qqqys
left a comment
There was a problem hiding this comment.
Independent Critical-only review — head 8b39a690
One file, nine added lines, no deletions: packages/web-shell/client/components/sidebar/WebShellSidebar.module.css.
No historical blocker
No review threads, no CHANGES_REQUESTED and no Critical recorded in any review body across the four prior comments. A maintainer approval stands at this head and CI is fully green with nothing outstanding.
The override targets a real declaration and wins without !important
The base rule reserves a gutter:
.body { … scrollbar-gutter: stable; } /* :480, declaration at :496 */and the new collapsed override releases it:
.collapsed .body {
…
scrollbar-gutter: auto; /* :1869 */
scrollbar-width: none; /* :1873 */
}
.collapsed .body::-webkit-scrollbar { display: none; } /* :1876 */I checked the cascade rather than assuming it: .collapsed .body carries two class selectors against .body's one, and appears later in the file (1862 versus 480), so it wins on both specificity and source order. No !important is needed and none is used, which keeps the rule overridable by a host theme.
The auto is load-bearing rather than cosmetic. stable exists to stop the expanded sidebar's content shifting when a scrollbar appears, but inside a 32px collapsed rail a reserved gutter takes a large fraction of the width and offsets the icons — the regression the linked issue describes. The added comment states that reasoning and, importantly, why hiding the scrollbar is part of the same fix rather than a separate preference: a visible scrollbar in the rail "would re-take layout width (re-creating the icon offset) the moment the session list overflows", so releasing the gutter alone would leave the bug reachable as soon as the list grows. Both declarations are needed together.
Covering scrollbar-width: none and ::-webkit-scrollbar { display: none } is the correct pairing — the standard property for Firefox and the pseudo-element for Blink and WebKit — so the behaviour does not depend on which engine renders the shell.
Scoping and accessibility
Everything is nested under .collapsed, so the expanded sidebar keeps both its stable gutter and its visible scrollbar; the blast radius is the collapsed rail only. Hiding a scrollbar does not disable scrolling: wheel, trackpad, touch and keyboard scrolling all still reach the overflowing session list, so no content becomes unreachable and nothing that was operable before stops being operable. That is the one way a change like this could cause real harm, and it does not.
The edit also stays inside the package's conventions: it is a CSS Modules file, so both selectors are locally scoped with no global leakage; no data-web-shell-* attribute, public --web-shell-* custom property, portal-root rule, z-index variable or animation registration is touched, and the scoping the build applies to generated CSS is unaffected.
Scope and CI
The diff is nine lines and I read all of them plus the base declaration they override; there is nothing in this PR I left unread. No test accompanies it, which per Critical-only scope is not a blocker — a collapsed-rail scrollbar is a visual property, and the repository's web-shell visual-capture lane is the surface that would catch a regression here. CI is green at head with no lane outstanding or failed.
Verdict: APPROVE — No Critical found. The override correctly releases the base rule's scrollbar-gutter: stable inside the collapsed rail, wins the cascade on specificity and order without !important, pairs the standard and WebKit ways of hiding the scrollbar so the fix is engine-independent, stays scoped to .collapsed, and hides the scrollbar without disabling scrolling, so no session becomes unreachable.
…s-p0-p8 Brings in main through 939b4db: QwenLM#12697 (http archive URLs rejected with an actionable error), QwenLM#12741 (batch task records that list cannot read) and QwenLM#12652 (scrollbar gutter in the collapsed sidebar rail). The merge is clean.


What this PR does
Fixes #12453: adds
scrollbar-gutter: auto;to.collapsed .bodyinpackages/web-shell/client/components/sidebar/WebShellSidebar.module.css(one line).Why it's needed
.bodysetsscrollbar-gutter: stable, which reserves a scrollbar-width gutter even in the collapsed rail where no scrollbar can appear. The reserved strip offsets the "new task" icon from the other rail icons (reported with a screenshot in #12453; root cause confirmed by doudouOUC on the issue). This supersedes #12454, which was closed because that branch accidentally committedqwen-dist-backup-*artifacts — this branch is a single-line source change.Reviewer Test Plan
How to verify
prettier --checkclean.Evidence (Before & After)
Before: collapsed rail shows the new-task icon shifted right by the reserved gutter (~scrollbar width) relative to sibling icons.
After: icons share one vertical axis; expanded sidebar unchanged (gutter rule untouched).
Tested on
prettier --checkon the file — clean. CSS-only change; no logic paths affected.Risk & Scope
.bodyrule is untouched, so expanded-mode scrolling is unaffected.welcome-prissue (yiliang114 invited a PR on the thread).Linked Issues