Skip to content

feat(web-ui): support middle-click to close right-sidebar and session tabs - #1339

Merged
iruriQ merged 1 commit into
mainfrom
feat/web-tab-middle-click-close
Nov 28, 2026
Merged

iruriQ merged 1 commit into
mainfrom
feat/web-tab-middle-click-close

Conversation

@iruriQ

@iruriQ iruriQ commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add standard browser/editor middle-click (auxclick, button === 1) tab closing to CH Web's closable tab strips:

  • Right-sidebar workbench tabs (apps/web-ui/packages/client/ui-dockkit/src/components/TabPanel.tsx):
    • Restrict onPointerDown docking drag start to primary button (event.button !== 0) so middle-click and mouse side buttons never start a drag or capture the pointer.
    • Prevent browser autoscroll on middle mousedown and close closable tabs on middle auxclick (ignoring events bubbled from portaled menus/tooltips via currentTarget.contains(target) and respecting canCloseTab).
  • Top recent-session shortcut tabs (apps/web-ui/packages/client/ui-workspace/src/client/RecentShortcut.tsx):
    • Prevent browser autoscroll on middle mousedown and close the session shortcut tab on middle auxclick via the same restoreNavigationFocus() + close(visit.sessionId) path as the × button.

UI Changes

No visual changes: adds middle-click pointer interaction equivalent to clicking the existing close (×) button on right-sidebar and recent-session tabs without altering layout, DOM structure, or styling.

Validation

  • npx prettier --check on both changed files & pre-commit hook (passed)
  • node tools/check-boundaries.mjs (passed)
  • npx tsc --noEmit -p apps/web-ui/tsconfig.json (passed)
  • Browser CJS tsdown bundle check for @deepseek-ai/dsh-client-ui-sidebar-right and @deepseek-ai/dsh-client-ui-workspace (passed)
  • npx vitest run --config tests/vitest.config.js apps/web-ui/packages/client/ui-workspace/test/ (2 files, 11/11 passed)
  • Full-repo CI checks run via GitHub Actions on this PR.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 新功能
    • 支持通过鼠标中键关闭可关闭的标签页和最近使用的快捷项。
  • 交互优化
    • 标签拖拽仅由鼠标或笔的主键按下启动;触摸和非主键按下不再触发拖拽。

本次更改调整了 TabStrip 的拖拽启动条件,并为 TabStrip 和 RecentShortcut 增加中键事件处理,以关闭标签或对应会话。

Changes: 中键关闭交互

Layer / File(s) Summary
标签与最近访问项的中键交互
apps/web-ui/packages/client/ui-dockkit/src/components/TabPanel.tsx, apps/web-ui/packages/client/ui-workspace/src/client/RecentShortcut.tsx
TabStrip 仅在主键鼠标或笔按下时启动拖拽。对于标签内部的中键事件,可关闭标签并切换菜单状态。RecentShortcut 对快捷项内部的中键事件阻止默认行为;辅助点击时阻止冒泡、恢复导航焦点并关闭对应会话。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to b145c

This adds middle-click closing for right-sidebar tabs and recent-session shortcut tabs with no intended layout change. No merge-blocking risk was found, and the change is easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题与变更内容一致:变更为右侧栏工作台标签和顶部最近会话快捷标签新增中键(auxclick)关闭功能。标题使用 feat(web-ui) 前缀,指出了主要功能。标题未提及拖拽限制和自动滚动阻止等次要改动,这属于正常范围。
Description check Passed 描述与变更相关。它说明了 TabPanel.tsx 和 RecentShortcut.tsx 中的中键关闭、拖拽起始限制、阻止自动滚动等改动,并列出了验证步骤。描述内容与变更集一致。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 30df393 and b145c07.

Files selected for processing: 2

  • apps/web-ui/packages/client/ui-dockkit/src/components/TabPanel.tsx
  • apps/web-ui/packages/client/ui-workspace/src/client/RecentShortcut.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check macos-26
  • GitHub Check: Vitest
  • GitHub Check: Static checks
  • GitHub Check: Check windows-latest
  • GitHub Check: Web Host tests
Additional context used

Code guidelines: 1

docs/product/standalone-web.md — auto-discovered
Path-based instructions: 1

Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.

CodeRabbit inference engine (docs/product/standalone-web.md)

Files:

  • apps/web-ui/packages/client/ui-dockkit/src/components/TabPanel.tsx
  • apps/web-ui/packages/client/ui-workspace/src/client/RecentShortcut.tsx
Additional comments: 2

apps/web-ui/packages/client/ui-dockkit/src/components/TabPanel.tsx: 1

322-323: LGTM!

Also applies to: 326-335, 336-348

apps/web-ui/packages/client/ui-workspace/src/client/RecentShortcut.tsx: 1

48-56: LGTM!

Also applies to: 57-68

@iruriQ
iruriQ merged commit 7f81726 into main Nov 28, 2026
4 of 8 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