Skip to content

fix(web-shell): clear scrollbar-gutter in collapsed sidebar rail (#12453) - #12652

Merged
wenshao merged 3 commits into
QwenLM:mainfrom
holny:fix/sidebar-collapsed-scrollbargutter-clean
Sep 26, 2026
Merged

wenshao merged 3 commits into
QwenLM:mainfrom
holny:fix/sidebar-collapsed-scrollbargutter-clean

Conversation

@holny

@holny holny commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Fixes #12453: adds scrollbar-gutter: auto; to .collapsed .body in packages/web-shell/client/components/sidebar/WebShellSidebar.module.css (one line).

Why it's needed

.body sets scrollbar-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 committed qwen-dist-backup-* artifacts — this branch is a single-line source change.

Reviewer Test Plan

How to verify

  • Diff is exactly one CSS declaration; prettier --check clean.
  • Collapse the sidebar: all rail icons (including new task) align on the same vertical axis; expand restores the gutter behavior.

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 --check on the file — clean. CSS-only change; no logic paths affected.

Risk & Scope

  • One line, scoped to the collapsed-rail override; the base .body rule is untouched, so expanded-mode scrolling is unaffected.
  • welcome-pr issue (yiliang114 invited a PR on the thread).

Linked Issues

…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 pomelo-nwu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@wenshao

wenshao commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Maintainer verification — real qwen serve on Windows / Linux / macOS (head 8b39a69)

Verdict: OK to merge. On every platform with classic (space-taking) scrollbars that I tested, main offsets the rail icons inside .body by 5–5.5 px from the New task icon, and the PR puts them back on the same axis. That holds both when the rail fits and when it overflows and scrolls. Where scrollbars are overlay, the PR changes nothing, and the expanded sidebar renders pixel-identical in both arms. The notes below don't block the merge.

How it was run

  • Arms. PR head 8b39a69 vs. its merge parent 9cb0180, which is today's origin/main. git diff between the two is exactly this one CSS file. Both arms are production builds. I normalized asset and CSS-module hashes and diffed the two Web Shell builds: the only semantic CSS difference is the two added rules.
  • Stack. A real qwen serve daemon serves each arm's production web-shell/, with its own QWEN_HOME and a real workspace. Playwright collapses the sidebar with the real footer Collapse button. It then measures the inline space .body reserves (offsetWidth − clientWidth) and every rail icon's centre x relative to the New task icon. When the rail overflows it scrolls it, and at the end it expands the sidebar again.
  • Viewports. 1280×900, where the rail fits, and 1280×460, where the rail content (168 px) overflows its 128 px scroll port.
  • Platforms.
    • Windows: GitHub-hosted windows-2022 (NT 10.0.20348), built from source on the runner, with the system Edge and Chrome.
    • Linux: GitHub-hosted ubuntu-24.04, same build.
    • macOS: local, with scroll bars forced to Always for one Chromium process via the -AppleShowScrollBars Always argument domain. No system setting was changed. Also run with the default overlay scrollbars.

Results (collapsed rail)

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.

Windows Edge, main vs PR

macOS classic scrollbars, incl. the PR's first commit

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: none is the declaration that does the work. The R1 follow-up commit 560f8b2 was 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 sets scrollbar-width: thin, and Chromium ≥ 121 ignores ::-webkit-scrollbar once the standard property is set.
  • The gutter reset is redundant in Chromium. Once scrollbar-width: none applies, 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)

  1. No test pins the fix. The 509 tests in client/components/sidebar/ and visual-capture-contracts.test.ts pass on the head. They also all pass with the CSS reverted to main. WebShellSidebar.css.test.ts already parses this stylesheet with postcss, so adding a pin is cheap. The candidate below is prettier-clean. Mutated at source level, it fails on main, 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');
      });
    });
  2. 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. On main it 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 to screenshots.spec.ts, would catch a regression in CI. On macOS the lane would stay blind, because overlay scrollbars reserve nothing there.

  3. The offset is 5–5.5 px, not the ≈4 px (or 7–8 px) estimated in the thread. Because scrollbar-width: thin is 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.

  4. 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 .body only holds the primary nav and the session-switcher trigger (the list itself is in a popover).

  5. Pre-existing, out of scope, identical in both arms. The collapsed footer is 245 px tall and opaque, but .collapsed .body only reserves margin-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 --check on 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 on 560f8b2 was 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 serve daemon 托管其生产版 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 滚动条。

结果(收起态)

平台 · 浏览器 滚动条 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 追加的 commit 560f8b2 是必要的:只有第一个 commit 时,侧栏一溢出,11 px 滚动条和偏移就回来了(见 macOS 图第三栏)。
  • webkit 规则在 Chromium 里不生效。 全局 * 规则已经设置了 scrollbar-width: thin,Chromium ≥ 121 在设置了标准属性后会忽略 ::-webkit-scrollbar。
  • gutter 复位在 Chromium 里是冗余的。 只要 scrollbar-width: none 生效,不加它也不会预留 gutter。
  • 这两条都无害,而且对不支持 scrollbar-width 的引擎(Safari < 18.2)有兜底作用。无需改动。

备注(非阻塞)

  1. 没有测试钉住这个修复。 client/components/sidebar/ 和 visual-capture-contracts.test.ts 的 509 条测试在 head 上全过;把 CSS 退回 main 后照样全过。WebShellSidebar.css.test.ts 已经用 postcss 解析这份样式表,加一条钉住的测试成本很低。上面英文部分给了一个候选用例(prettier 格式干净)。在源码级变异下,它在 main、m1、m4 上失败,在 head、m2、m3 上通过,与浏览器实测完全吻合。
  2. visuals 通道看得见这个 bug,只是缺场景。 我照该通道的浏览器配置跑了一遍:Ubuntu 上 Playwright 自带的 headless Chromium,默认启动参数(含 --hide-scrollbars)。main 仍然预留 10 px、图标偏移 5 px:滚动条不绘制,但宽度照样预留。所以 triage 建议的后续工作——在 screenshots.spec.ts 里补一个收起态截图——能在 CI 里抓住回归。只有在 macOS 上它会失明,因为 overlay 滚动条不预留空间。
  3. 偏移是 5–5.5 px,不是线程里估算的 ≈4 px(或 7–8 px)。 由于全局设置了 scrollbar-width: thin,Chromium 用的是原生细滚动条:Windows 和 Linux 上 10 px,macOS 上 11 px;::-webkit-scrollbar { width: 8px } 被忽略。
  4. 可发现性权衡(可接受)。 460 px 时,Project/会话切换器图标一开始在视口之外。main 上经典滚动条会提示侧栏可以滚动,head 上没有任何提示,这与 macOS overlay 用户本来的体验一致。滚轮和触控板滚动都正常。可选的小问题:新增的 CSS 注释写的是「会话列表溢出时」,但收起态下 .body 里只有主导航和会话切换器按钮(会话列表本身在弹层里)。
  5. 既有问题,不在本 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) 仍在运行。

@wenshao

wenshao commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

@qwen-code /triage

@wenshao
wenshao enabled auto-merge September 26, 2026 08:59

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@wenshao
wenshao added this pull request to the merge queue Sep 26, 2026
Merged via the queue into QwenLM:main with commit 939b4db Sep 26, 2026
80 checks passed
wenshao added a commit to doudouOUC/qwen-code that referenced this pull request Sep 26, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

当左侧边栏收起后,“新建任务”的图标与其他图标没有垂直对齐

4 participants