Skip to content

fix(web): save edited annotations before direct send - #1184

Merged
iruriQ merged 3 commits into
BytePioneer-AI:mainfrom
hhucz:feat/web-response-annotation-edit
Nov 25, 2026
Merged

iruriQ merged 3 commits into
BytePioneer-AI:mainfrom
hhucz:feat/web-response-annotation-edit

Conversation

@hhucz

@hhucz hhucz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Save the active response-annotation comment before a primary send press, including on touch devices where the existing focus preservation can otherwise submit the previous comment.
  • Keep the quoted text and message format unchanged, and add focused coverage for the annotation-editor blur helper.
  • Document the re-editing and direct-send requirements in the existing response-annotation OpenSpec change and product documentation.

Related issues

N/A

UI Demo

No visual changes: this PR only changes focus/submission ordering; the annotation tray appearance and styling are unchanged.

Test plan

  • npx vitest run --config tests/vitest.config.js apps/web-ui/packages/client/ui-conversation/test/view-binding.test.ts — 1 test passed.
  • npx tsc -b packages/web-server && npm run build:web:ui — passed.
  • Isolated Chrome with FakeChHost, mobile emulation at 390×844: reproduced the stale comment on the unmodified base, then verified after the fix that both the actual turn/start payload and the sent-message annotation card contain the new comment; no page errors.
  • Isolated Chrome at 1280×800: Enter save, Escape cancel, and direct send with an edited comment passed; no page errors.
  • Focused Prettier check for all changed files, git diff --check, and UTF-8 without BOM checks passed.
  • Rebased onto the latest upstream/main without conflicts; upstream did not change the affected files.
  • Not run: full-repository checks (per the repository verification budget), physical iOS/Android devices, or OpenSpec strict validation because the CLI is not installed in the project or environment.

🤖 Generated with Claude Code

On touch devices the send button preserves focus, so the annotation textarea's blur handler may not run before submission. Explicitly blur the active annotation editor on primary-send mousedown and cover the focus helper with a focused unit test.
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 新功能
    • 发送前可编辑已有批注备注,也可为仅含选中文字的批注添加备注;修改后会保留选中文字及其来源位置。
    • 点击发送时会先保存正在编辑的备注,再发送消息;发送内容和发送后的历史记录均使用最新备注。
    • 支持按 Enter 保存、Shift+Enter 换行,以及按 Esc 取消修改。
  • 问题修复
    • 点击主按钮时,批注编辑器会先失焦,并将焦点恢复到草稿编辑器。

新增批注编辑器失焦函数,并将其接入主按钮的焦点处理。规范和产品文档补充备注编辑、直接发送前保存及消息使用新备注的要求。

Changes: 批注备注编辑与发送

Layer / File(s) Summary
备注编辑与发送要求
openspec/changes/add-web-response-annotations/specs/web-response-annotations/spec.md, openspec/changes/add-web-response-annotations/tasks.md, docs/product/standalone-web.md
规范新增修改、补写和清空备注,以及 Enter、Shift+Enter、Esc 和直接发送的场景;任务文件记录相关任务已完成。产品文档说明点击发送时先保存备注。
主按钮焦点处理
apps/web-ui/packages/client/ui-conversation/src/client/input/editor/view-binding.ts, apps/web-ui/packages/client/ui-conversation/src/client/skeleton/InputBar.tsx, apps/web-ui/packages/client/ui-conversation/test/view-binding.test.ts
新增 blurActiveAnnotationEditor,在活动元素为注释容器内的文本区域时调用 blur()。主按钮在不是 Stop 操作且按下主键时调用该函数,然后恢复草稿编辑器焦点。测试覆盖匹配和不匹配的活动元素。

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

Change: Bug fix

Possibly related PRs

  • BytePioneer-AI/codex-host#856:该 PR 引入回复选区批注的 Composer 状态和发送格式;本 PR 的备注编辑与发送前保存要求基于这一批注模型。

Suggested reviewers: bytepioneer-ai, lpmasser

Merge Risk: Minimal · previous review 85c67

Clicking send while editing an annotation comment now saves the edit first, so the sent message uses the new comment. The code path appears consistent with the intended behavior, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(web): save edited annotations before direct send”概括了主要变更:在主发送按钮按下前保存正在编辑的响应批注备注。该标题与 view-binding、InputBar 的焦点顺序修改及相关规范文档一致,未包含无关内容。
Description check Passed 描述说明了变更目的(发送前保存当前批注备注,包括触摸设备)、新增的 blur 辅助函数测试、OpenSpec 与产品文档更新,以及测试计划。描述与变更集直接相关。
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.
  • 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

@iruriQ
iruriQ merged commit cee1158 into BytePioneer-AI:main Nov 25, 2026
@iruriQ

iruriQ commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks for fixing this subtle touch/direct-send annotation bug! Before merging into main, we reverted the 2 out-of-scope edits in the archived-phase openspec/changes/add-web-response-annotations/ directory (keeping the docs/product/standalone-web.md note), verified view-binding.test.ts + Prettier, and confirmed on an isolated 390×844 touch Web run that editing a note without pressing Enter and tapping Send directly submits the updated note.

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.

3 participants