Skip to content

fix(desktop): 指针移出模型列表时收起打开的行 - #443

Merged
bubbleptr merged 1 commit into
mainfrom
fix/model-selector-flyout-leave-list
Oct 7, 2026
Merged

bubbleptr merged 1 commit into
mainfrom
fix/model-selector-flyout-leave-list

Conversation

@bubbleptr

@bubbleptr bubbleptr commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #442

根因

悬停一行会打开该行的选项飞出层并点亮该行,但清除这份状态的只有面板级 onMouseLeave(300ms 宽限)。指针从行移到面板底部的 Add Models 行时,既没离开面板、也没进入另一行,于是没有任何 handler 结束这次 hover——上一行继续高亮,飞出层一直开着。

改动

model-selector-control.tsx:面板内已有的 onPointerMove(trackPointer)在记录 safe-triangle 轨迹之外,判断落点是否仍在「模型列表 + 飞出层」集群内;若不在(搜索框、Add Models 行、面板内边距)且当前有打开的行 → closeFlyoutNow() 立即收起(不走宽限)。

保留不变:安全三角切换、28px 隐形悬停桥、离开整个面板的 300ms 宽限。「行 → 飞出层」的斜穿路径不经过集群之外,因此不受影响。

.scratch/model-selector/PRD.md 悬停意图一节补记该规则。

验证

单测(model-selector-control.test.tsx,先红后绿):悬停最后一行 → 飞出层打开且 aria-current=true;移到 Add Models → 飞出层卸载、aria-current 清空。

真实浏览器(bun run dev:mock + Playwright,/design 页 ModelSelectorControl 画廊)逐条核对:

场景 结果
悬停行 → 高亮 + 飞出层 ✅ data-open=true,aria-current=true
移到 Add Models ✅ 高亮清空、飞出层卸载
移到搜索框 ✅ 同上
斜穿 28px 缝隙进入飞出层 ✅ 飞出层保持打开,行保持高亮
移出面板再回到同一行 ✅ 300ms 宽限生效,飞出层未被打断

bun run typecheck / bun run lint / bun run test(1978 passed)/ bun run build 全绿。


Devin Review

Hovering a row opens its options flyout and keeps the row lit. Only the
panel-level mouseleave cleared that state, so a pointer moving from a row
down to the Add Models row (or up to the search field) left the row above
lit with its flyout still open.

The panel's pointermove now ends the hover as soon as the pointer settles
outside the list/flyout cluster. Leaving the panel still goes through the
300ms grace period the safe-triangle gap crossing relies on.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@bubbleptr
bubbleptr merged commit b328fc5 into main Oct 7, 2026
2 checks passed
@bubbleptr
bubbleptr deleted the fix/model-selector-flyout-leave-list branch October 7, 2026 06:11
@bubbleptr bubbleptr mentioned this pull request Oct 7, 2026
3 tasks done
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.

模型选择器:指针移到 Add Models 时上一行仍保持高亮与飞出层

1 participant