Skip to content

fix(ui): 右侧工具栏在左侧边栏展开时内容跟随面板宽度重排 - #841

Merged
Loosand merged 1 commit into
Stack-Cairn:developfrom
AlphaCatMeow:fix/right-sidebar-overlap-develop
Sep 20, 2026
Merged

Loosand merged 1 commit into
Stack-Cairn:developfrom
AlphaCatMeow:fix/right-sidebar-overlap-develop

Conversation

@AlphaCatMeow

@AlphaCatMeow AlphaCatMeow commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Linked issue

Closes #840

Summary

右侧工具栏打开时展开左侧边栏,右栏变窄了,内容却保持原来的像素宽度,左边一截被 panel 的 overflow: hidden 裁掉,看起来像被主面板盖住。

WorkspaceToolsPanel 的内容层宽度固定为 savedWidth,只在拖拽期间切到 100%。这个固定宽度只有开关动画那 200ms 有用:让内容随 flex-grow 过渡滑入,避免动画期间反复重排。动画结束后它就成了负担,panel 组一变窄(左栏展开)内容就溢出。

改法:加一个 settled 状态。打开后等过渡结束(240ms,对应 duration-200)把内容层切到 100%immediate 模式直接 100%;关闭或移动端复位。之后左栏展开,主面板位移,右栏同步缩窄,内容按新宽度重排。

这个组件桌面端 ChatPage.tsx 和 gateway web GatewayAppView.tsx 共用,一处修复覆盖两端。

Change scope

  • Modules: agent-ui(桌面端与 gateway web 共用)
  • Key paths:
    • crates/agent-ui/src/components/project-tools/WorkspacePanels.tsx
    • crates/agent-gui/test/chat/sidebar-shells.test.mjs(新增回归测试,并把 panel 布局 mock 抽成 installPanelLayoutMocks
    • docs/worklog/right-dock-clipped-when-sidebar-expands.md

Screenshots / preview

2026-09-20_16-09-10

Verification

  • 新增测试 "tools panel content follows the panel width once the open animation settles":node --test crates/agent-gui/test/chat/sidebar-shells.test.mjs 7/7 通过
  • node scripts/run-node-tests.mjs test/chat(agent-gui):1441 pass / 7 fail,同样的 7 个失败在未改动的 develop 基线上也存在(源码扫描类测试受 CRLF 影响),与本次改动无关
  • tsc --noEmit -p crates/agent-ui/tsconfig.json 通过
  • Windows 桌面端与 gateway web 端手动验证:右栏打开时反复收起、展开左栏,右栏内容随宽度重排,不再裁切;打开右栏的滑入动画不受影响

Pre-submit checklist

  • A requirement issue is linked (or this is a trivial fix that needs no issue, as explained in the summary).
  • Synced with the target branch; no merge conflicts.
  • The change is focused, with no unrelated modifications.
  • No secrets, tokens, or personal data included.
  • Docs are updated for changes affecting user behavior, deployment, or configuration.

The tools panel content kept its saved pixel width anchored right. When the
group shrank (left sidebar expanded) the panel kept its percentage share and
got narrower, so the fixed-width content overflowed to the left and was
clipped by the panel's overflow: hidden, looking as if the main column
covered it. Only keep the fixed width during the open transition; once
settled, size the content to 100% of the panel.
@StackCairn
StackCairn marked this pull request as draft September 20, 2026 07:09
@github-actions

github-actions Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

PR governance checks passed. Awaiting human review.

@AlphaCatMeow
AlphaCatMeow marked this pull request as ready for review September 20, 2026 08:09
@Loosand
Loosand merged commit 64a9bfd into Stack-Cairn:develop Sep 20, 2026
10 of 11 checks passed
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.

2 participants