Repository navigation
fix(app-ui): keep hover tooltips closed on touch input - #5370
Conversation
🦋 Changeset detectedLatest commit: 55c4de9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 557fb8bf44
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
* fix(app-ui): keep hover tooltips closed on touch input * fix(app-ui): preserve mouse hover and cancel pending hover on touch
* fix(app-ui): keep hover tooltips closed on touch input * fix(app-ui): preserve mouse hover and cancel pending hover on touch
Requirement or Bug
移动端浏览器(如 iOS Safari 打开
kimi web)里,点按带悬停提示的元素——最明显的是折叠后的工具调用摘要栏(“编辑了 4 处”、“运行了 1 条命令”)——会弹出一直不消失的 Tooltip 气泡。滚动会话或点按其他位置后,多个白色气泡仍悬浮在正文上方。本 PR 让触屏输入不再触发悬停 Tooltip,点按只执行元素本身的动作。Bug Reproduction Steps
kimi web,进入一段包含已折叠工具调用记录的会话。Root Cause
这是在共享的
TooltipBubble触发层做的根治,而不是在各个调用点打补丁。TooltipBubble监听pointermove时没有检查event.pointerType。手机 Safari 在点按带:hover样式的元素时,会在click之前派发一次pointerType: 'touch'的pointermove。一旦此前的指针采样让pointerMovement进入已就绪状态,点按带来的坐标变化会让isSyntheticPointerMove返回false,从而执行show()。sequenceDiagram participant User as 用户 participant Safari as 移动 Safari participant Tip as TooltipBubble User->>Safari: 点按摘要栏 Safari->>Tip: pointermove(pointerType: 'touch',坐标改变) Note over Tip: 已就绪后 isSyntheticPointerMove() === false Tip->>Tip: 150ms 后执行 show()(Teleport 到 body,position: fixed) User->>Safari: 滚动会话 / 点按空白处 Note over Safari,Tip: 不触发 mouseout / mouseleave / focusout,也不触发 resize Note over Tip: 气泡一直停留在屏幕上气泡弹出后,在触屏上没有任何关闭路径:滚动或点按不可悬停区域不会触发
mouseout/mouseleave/focusout;subscribeViewportChange只监听window.resize(不随滚动关闭是桌面鼠标用户的有意设计);同时每个TooltipBubble实例各自管理open状态,因此屏幕上会同时残留多个气泡。Code Changes
在
TooltipBubble的pointermove入口(IconButton/NumberInput使用的target模式,以及Tooltip使用的delegate模式)增加悬停守卫,并新增pointerdown监听。被拦截的指针会取消待弹出或已打开的悬停气泡,避免混合设备上鼠标静止悬停时手指点按仍留下气泡。键盘:focus-visible的onFocus逻辑保持不变。pointerType === 'touch'一律拦截,覆盖纯触屏设备以及主输入支持悬停的混合设备上的手指点按。pointerType === 'mouse'一律放行,因为 CSS 的hover只描述主指针:在触屏仍是主指针((hover: none))的混合设备上,外接鼠标依然可以正常悬停。pen或未知类型)仅在所有可用指针都不支持悬停((any-hover: none))时拦截。pointerdown处理是为了覆盖部分浏览器在触摸按下前不派发pointermove的情况,在 150ms 计时器触发前将其取消。Behavior Changes and Affected Users
Tooltip/IconButton/NumberInput触发元素上的pointerType: 'touch'pointermove/pointerdownkimi web)触屏用户ContextComposition.vue不可选择模式下的角色消息条数row.count;MediaTool.vue.media-title的完整路径media.path):focus-visible,或打开媒体预览(hover: none)仍为true)的混合输入设备上,pointerType: 'mouse'的pointermove(any-hover: none))时,pointerType: 'pen'或未知类型的pointermove:focus-visible,或改用支持悬停的指针:focus-visible受影响模块与测试覆盖:
packages/app-ui/src/components/ui/TooltipBubble.vue:桌面端和 Web 所有Tooltip、IconButton、NumberInput共用的气泡组件。Markdown 链接/代码预览(linkTooltip.ts、codeTooltip.ts)和输入区的mentionTooltip.ts是独立实现,未改动。packages/app-components/test/tooltipViewportListeners.test.ts:在tooltip hover input下新增 6 条回归测试,覆盖:ActivityRun摘要栏模式)上的触摸移动不弹出;(any-hover: none)匹配时手写笔移动不弹出;(hover: none)匹配时鼠标悬停仍可弹出;pointermove的触摸pointerdown能取消待触发的鼠标悬停计时器;pointermove能关闭已打开的 delegate 气泡。每条新增测试在修复前都会失败、修复后通过;原有的桌面鼠标悬停、窗口尺寸变化关闭和忽略滚动的测试未改动。
验证详情
pnpm exec vitest run --reporter=agent packages/app-components/test/tooltipViewportListeners.test.ts packages/app-components/test/browserActivityRun.test.ts packages/app-components/test/genericTool.test.ts packages/app-components/test/workspaceEditDialog.test.ts packages/app-components/test/sessionListPanelRerender.test.ts packages/app-components/test/sessionRowWorkspaceLabel.test.ts packages/app-components/test/sessionRatingRow.test.ts— 7 个文件、110 条用例全部通过。pnpm --filter kimi-code-app run typecheck— 通过。pnpm lint— 通过。pnpm run check:duplication 2b1b095f3bbf48e83632b0aaaabce6773caf4469— 通过,无新增重复代码。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.