You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web-ui): preserve composer focus and caret visibility after attaching images - #1123
The change keeps the composer focused and its caret visible after attaching images. No concrete merge-blocking defect was established. Manual WKWebView verification remains outstanding.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
标题“fix(web-ui): preserve composer focus and caret visibility after attaching images”准确概括了主要变更:附加图片后保持输入框焦点并保证光标可见。变更集中在 runtime.ts(空段落)、view-binding.ts(refreshDraftCaret)、InputBar.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: 8
GitHub Check: CodeRabbit
GitHub Check: Check macos-26
GitHub Check: Check ubuntu-22.04
GitHub Check: Vitest
GitHub Check: Check Linux ARM64
GitHub Check: Check windows-latest
GitHub Check: Static checks
GitHub Check: Web Host tests
Additional context used
Code guidelines: 1
AGENTS.md — auto-discovered
Path-based instructions: 1
Source excerpt: Do not write browser, e2e, or component tests for Web pages (`apps/web-ui`); the user checks page changes directly.
Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-17T12:08:52.064Z
Learning: Source excerpt:
# Repository Guidelines
## Testing & Completion
- Do not write browser, e2e, or component tests for Web pages (`apps/web-ui`); the user checks page changes directly. Codex Desktop compatibility after an update is checked with `npm run audit:codex-desktop` and `npm run probe:renderer-binding` (`codexhost-update-impact-audit`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复在 Web UI / 桌面壳(WKWebView)输入框中附加或移除图片后,输入区不显示光标的问题:
ParagraphNode)(ui-conversation/src/client/input/editor/runtime.ts):clearCommittedDraft清空后自动写入一个空<p><br></p>,确保 Lexical 的editor.focus()在空草稿上能建立有效选区,同时为 WebKit(WKWebView/ Safari)提供稳定的行盒锚点。ui-conversation/src/client/skeleton/InputBar.tsx、view-binding.ts):+菜单/文件选择器、桌面截图附加)在提交渲染后恢复桌面端编辑器焦点,避免失焦态拖放或原生文件选择器/弹窗关闭后焦点落回document.body;失败发送自动回填的旧附件 ID 不抢占其他控件焦点,移动端不强制弹出软键盘。requestAnimationFrame布局稳定后调用refreshDraftCaret重新应用折叠选区,避免附件栏挂载/收起导致输入区纵向位移后 WebKit 未重绘光标。ui-attachment/src/client/ComposerAttachments.tsx、FileCard.tsx、AttachmentRail.tsx):onMouseDown的preventDefault(),点击操作时保持输入框焦点与光标不中断。Related issues
无 / N/A
UI Demo
使用隔离预览服务与合成测试图片截取(仅包含输入卡片,已折叠侧边栏,无个人路径/会话信息):
Test plan
npx vitest run --config tests/vitest.config.js apps/web-ui/packages/client/ui-conversation/test/:4 个测试文件、9 个用例全部通过npx tsc -p apps/web-ui/tsconfig.json --noEmit:通过npx prettier --check(6 个改动文件):通过node --import tsx apps/web-ui/scripts/build.ts && npm run pack --workspace=@codexhost/web-server:通过ego-browser,macOS)实测并截图确认:Cmd+V粘贴图片、失焦态拖放图片、+菜单搜索file选图、点击×移除图片后,输入框均保持聚焦、选区位于<p>且光标可见,并可直接连续输入。CodexHost.app(WKWebView)真机前台窗口未在本轮自动化脚本中运行(待实机复核);全仓库lint/test交由 CI 执行。