Skip to content

fix(web-ui): scope TurnProcess collapse focus transfer to process members - #1337

Merged
iruriQ merged 1 commit into
mainfrom
fix/turn-process-collapse-focus-scope
Nov 28, 2026
Merged

iruriQ merged 1 commit into
mainfrom
fix/turn-process-collapse-focus-scope

Conversation

@iruriQ

@iruriQ iruriQ commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1322 addressing a review finding on TurnProcessNodeView: collapsing a completed turn's process section previously matched active.closest("[data-chat-turn]"), which also includes visible final assistant answers and other non-collapsible nodes in the same turn, unnecessarily moving focus away from visible answer controls when collapsing the process header.

Changes

  • apps/web-ui/packages/client/ui-chat/src/client/chat/TurnProcessNodeView.tsx: Narrow the collapse focus-transfer check from [data-chat-turn] to [data-turn-process-member], [data-step-process] (still matched against data-chat-turn === String(node.data.turn)). This covers both ChatNodeSeat[data-turn-process-member] and ChatGroupSeat[data-step-process] (including nested ProcessGroupHeader buttons that live outside ChatNodeSeat and would otherwise trigger useSearchableHidden reveal on collapse), while leaving focus untouched on visible final answers and independent turn nodes.

Visual Changes

No visual changes: narrows focus-transfer scope on Turn process collapse without altering layout, styling, or visual presentation.

Validation

  • pre-commit Prettier formatting check on apps/web-ui/packages/client/ui-chat/src/client/chat/TurnProcessNodeView.tsx: passed.
  • Verified ChatNodeSeat (data-turn-process-member, data-chat-turn) and ChatGroupSeat (data-step-process, data-chat-turn) DOM attributes directly against main.
  • Full-repo lint/typecheck/test delegated to CI per AGENTS.md.

…bers

Follow-up to #1322: TurnProcessNodeView previously checked active.closest("[data-chat-turn]") when collapsing a completed turn, which also matched visible final assistant answers and other non-collapsible nodes in the same turn.

Narrow the selector to "[data-turn-process-member], [data-step-process]" so focus transfers to the toggle button only when activeElement is inside collapsible process nodes or process group containers (including group headers) belonging to that turn.
@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

  • 问题修复
    • 收起处理步骤时,焦点现在仅在位于当前对话轮次的相关内容中时才移回切换按钮,避免焦点被无关内容触发。

折叠 Turn process 前,焦点检查现在仅匹配指定后代中 data-chat-turn 值等于当前 turn 编号的元素。匹配后,仍按原有方式将焦点移回按钮,再切换展开状态。

Changes: Turn process 焦点处理

Layer / File(s) Summary
收窄折叠前的焦点匹配
apps/web-ui/packages/client/ui-chat/src/client/chat/TurnProcessNodeView.tsx
焦点检查仅匹配 [data-turn-process-member] 或 [data-step-process] 后代中 data-chat-turn 值等于当前 turn 编号的元素。移除了对按钮自身的显式排除。

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

Change: Bug fix

Possibly related PRs

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 0ea8c

The change narrows when focus moves to the toggle as a completed turn's process section collapses. No concrete regression has been identified, and the change is small and easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题描述了主要变更:将 TurnProcess 折叠时的焦点转移范围限定为流程成员节点。该标题与变更集中的 TurnProcessNodeView.tsx 焦点检查修改直接相关,且修复类型(fix)和范围(web-ui)明确。
Description check Passed 描述说明了问题背景(折叠时 active.closest("[data-chat-turn]") 匹配范围过宽)、具体修改(改为 [data-turn-process-member], [data-step-process] 并保留 data-chat-turn 比较)以及验证步骤。与变更集高度相关。
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 0d666bf and 0ea8c84.

Files selected for processing: 1

  • apps/web-ui/packages/client/ui-chat/src/client/chat/TurnProcessNodeView.tsx

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

Recent review details

Context from checks skipped due to timeout: 7

  • GitHub Check: Web Host tests
  • GitHub Check: Check windows-latest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Static checks
  • GitHub Check: Vitest
  • GitHub Check: Check macos-26
  • GitHub Check: Check Linux ARM64
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-chat/src/client/chat/TurnProcessNodeView.tsx

@iruriQ
iruriQ merged commit b87ddcb into main Nov 28, 2026
5 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