fix(desktop): 选完模型后把焦点送回输入框 - #3313
Conversation
新建任务页选完模型后,选择器卸掉会把焦点掉到 body,必须再点一次才能接着打字。composer 工具条现在在选择器关闭后把焦点送回输入框,并阻止 pill mousedown 抢焦。 Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bc20cf894
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/components/ui/morph-popover.tsx | 新增可选回焦目标,并区分指针关闭、键盘关闭及外部控件已接管焦点的场景。 |
| apps/desktop/src/renderer/components/new-chat/ChatInput.tsx | 将仍有效的 composer 编辑器 DOM 暴露为模型选择器关闭后的回焦目标。 |
| apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx | 传递回焦目标,并阻止 morph trigger 的 mousedown 抢走输入焦点。 |
| apps/desktop/src/renderer/tests/morphPopover.test.tsx | 覆盖指针选择、收合动画、Esc 关闭和焦点交接等新增契约。 |
| apps/desktop/src/renderer/tests/composerMorphScope.test.ts | 验证新回焦行为仅接入 composer 模型选择器,不改变设置页等入口。 |
Reviews (2): Last reviewed commit: "fix(desktop): 选完模型立刻回焦,Esc 仍回 pill" | Re-trigger Greptile
指针关闭(选模型 / 点空白)在 inert 后马上把焦点送回输入框,避免收合动画那 240ms 里打的字被丢掉。Esc 等键盘关闭仍归还 trigger,遵守 DESIGN.md §14.2。 Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
MagicLizi
left a comment
There was a problem hiding this comment.
按维护者指示批准;合并仍需通过 review-pr 的代码审查与其余安全门。
|
命中 UI 路径(ChatInput / ModelSelector / morph-popover)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面,便于确认界面符合 DESIGN.md 设计规范。本条不阻断合并。 |
|
选完模型后焦点回到输入框,少点一次鼠标,对话能接着打。 |
这次改了什么
摘要
新建任务页选完模型后,输入框会丢掉焦点,必须再点一次才能接着打字。现在选完模型、按 Esc 或点空白关掉选择器后,焦点会回到输入框;点模型 pill 也不会先把光标抢走。设置页的模型选择器行为不变。
变更类型
fix缺陷修复feat新功能refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
restoreFocusTargetUI 变化
无新视觉元素。交互上,composer 工具条的模型选择器关闭后焦点回到输入框。
怎么验证的
自动验证
手工验证
未在本机启动 Desktop 实机点选。请在新建任务页:先点输入框,再打开模型选择器选一个模型,选完应能直接接着打字。Light / Dark 都只改焦点,没有新样式。
未执行的验证
pnpm test:unit:预跑时ghostInstallReceipt.test.ts有 2 个失败,与本 diff 无关(cindy-brain 收据校验),交 CI 兜底风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)