Skip to content

fix(sidebar): keep the bottom workbench toggle while the right panel is open - #1053

Merged
Menghuan1918 merged 3 commits into
omdsh-dev:devfrom
WinterXMQ:fix/bottom-toggle-with-right-panel
Oct 26, 2026
Merged

Menghuan1918 merged 3 commits into
omdsh-dev:devfrom
WinterXMQ:fix/bottom-toggle-with-right-panel

Conversation

@WinterXMQ

Copy link
Copy Markdown
Contributor

问题

先展开宿主原生右侧栏,会话头右上角的底部工作台开关就整枚消失,只能先收起右栏才能打开工作台。

根因是 BottomDockToggle 里的一条早退:

if (useRightPanelOpen()) return null

它当初的理由是「右栏展开时右上角是一簇自己的控件(Split / Fullscreen / Collapse right sidebar),入口挤进去会跟它们打架」。但这两者并不在同一列:右栏控件簇在右栏列内,而本入口挂在会话头的 conversation.session.header.utilities(中间列),中间还隔着 headerCorner。所以这条早退既没有避免冲突,又让入口在最需要的时候不可达。

改动

  • src/client/Sidebar.tsx:删掉 if (useRightPanelOpen()) return null 与对应 import,注释改写为「为什么现在可以常显」。
  • src/client/sidebar/dock-fallback.tsx:只改注释。空白会话的 position: fixed 兜底入口保留 rightOpen 判断——它锚在右栏控件左侧,右栏展开时锚点落在面板内部,放过去会盖住面板内容。两条入口的取舍不同,注释写明区别。
  • tests/bottom-toggle.spec.tsx(新增,2 用例):
    • 宿主右栏展开态(可见的 [data-sidebar-right-toggle])在场时,[data-dsh-bottom-toggle] 仍然渲染;
    • 点击翻转 store 的 bottomOpen。
  • CHANGELOG.md:未发布段补一条用户可见说明。

验证

  • pnpm typecheck:通过。
  • pnpm vitest run tests/bottom-toggle.spec.tsx tests/dock-fallback.spec.tsx tests/theme.spec.ts:33 passed。
  • pnpm test:2772 passed / 1 failed,唯一失败是 tests/plugin-meta.spec.ts 的 Windows tar 输出 CRLF(package/icon.svg\r);该失败在 dev 基线上可复现,与本改动无关。
  • pnpm build:通过;产物 lib/client.js 中 data-dsh-bottom-toggle 命中 5 次(与改动前一致)。
  • 本地 desktop profile 以 link: 方式挂载本分支,重启后无 pageerror / console error。

未验证项:pnpm test:mount 真实挂载门禁需要在 DSH 0.2.1-rc.1 基线上跑(本机 PATH 上是 0.2.0-rc.2),留给 CI。

范围

不改 host、不加依赖/路由、不改会话格式、不新增轮询。空白会话兜底入口的行为保持不变。


…is open

The header toggle bailed out whenever the host's right sidebar was expanded,
so opening that panel first left the bottom workbench unreachable until it was
collapsed again. The session header's utilities seat and the panel's own
Split / Fullscreen / Collapse cluster sit in two different columns, so they
never overlap.

The blank-session fixed fallback keeps its guard: that entry anchors to the
left of the panel controls and would cover panel content while expanded.

tests/bottom-toggle.spec.tsx pins both behaviours.
The header toggle no longer hides while the host's right panel is expanded.
davidLi17 added a commit to davidLi17/DSH-better-sidebar that referenced this pull request Oct 25, 2026
Selectively backport open upstream PRs omdsh-dev#1040 (598714b), omdsh-dev#1055 (828452a), and omdsh-dev#1053 (f2ad4b1). Isolate Mermaid layout with authenticated sandbox messaging, recover from malformed diagrams, cancel/promote queued renders, preserve Windows Markdown separators and keep the bottom workbench toggle reachable.

Preserve LHG draft/image sidechat behavior and selective omdsh-dev#1050 performance fixes. Ship prebuilt lib without lifecycle hooks. Validation: 230 files, 2790 tests passed, 17 skipped; typecheck, lint, build, consumer types, pack and fresh official DSH rc1 install/start passed. Real browser UI and native Windows unverified; see maintenance record.
@Menghuan1918
Menghuan1918 merged commit 1eeec0c into omdsh-dev:dev Oct 26, 2026
wally8-8 pushed a commit to wally8-8/DSH-better-sidebar that referenced this pull request Nov 21, 2026
blank 会话里宿主不渲染会话头 utilities,插件的底部工作台入口只剩右上角那个
备用入口;而它在宿主右侧面板展开时整个不渲染,于是「先开右栏」就再也打不开
底部工作台。omdsh-dev#1053 修的是正常会话的会话头入口,这一处当时被留了下来。

现在展开态照常渲染,并改锚**面板左缘**:展开态宿主的 Split / Fullscreen /
Collapse 搬进了面板内部,锚在那簇控件左侧会落进面板、盖住面板内容;面板左缘
那一格是会话头那一行的右端空位,与收起态入口同一列。

真实宿主(DSH 0.2.2-rc.5 + Chromium,1440x900,空白新会话)实测:
- 收起态:入口 1364,11(不变);
- 展开态:修复前屏上 0 个入口,修复后 756,10(面板左缘 792),点击可打开底部面板。

tests/dock-fallback.spec.tsx 把「展开态不渲染」改成「展开态渲染且锚在面板左缘
756px 并仍可点击」(还原旧守卫即红);tests/e2e/blank-session-dock-entry.e2e.ts
新增真实宿主用例:展开右栏后入口仍在、屏上恰好一个、右缘不越过面板左缘。
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