Skip to content

feat(canvas): open selection toolbar menus on hover - #572

Merged
FayeSpica merged 1 commit into
ThinkFlowLab:mainfrom
Zhangbo-cn:feat/selection-toolbar-hover
Nov 29, 2026
Merged

FayeSpica merged 1 commit into
ThinkFlowLab:mainfrom
Zhangbo-cn:feat/selection-toolbar-hover

Conversation

@Zhangbo-cn

Copy link
Copy Markdown
Contributor

背景

实现 #571。选中节点后的操作条里,「预设」「多角度」「智能打光」「营销工具」「工具」等标签都必须先点一下才展开菜单;对比同类工具「鼠标移到标签上自动展开」的交互,每次都要多点一下。

改动

src/canvas/NodeSelectionToolbar.tsx

  • 指针停留 ~120 ms 后自动展开该标签的菜单;离开标签 ~180 ms 后收起。
  • 进入菜单会取消收起,斜向从标签移到菜单项不会闪断。
  • hover 打开的菜单不抢焦点(焦点留在标签上);点击打开的菜单保持原行为(聚焦第一项)。
  • hover 打开后点标签不会误关闭,再点一次才关闭;ArrowDown/ArrowUp、Enter、Tab 等键盘路径不变。
  • 锁定/禁用动作不因 hover 展开;指针快速划过整条工具条只会展开停留的那个(延迟 + 取消实现)。

src/canvas/SelectionToolbarMenu.tsx

  • 新增可选 focusOnMount(默认 true,点击路径不变)与 onPointerEnter/onPointerLeave,让指针进入菜单时保持打开。

验证

  • 新增浏览器用例 tests/browser/selection_toolbar_hover.mjs(已登记 manifest gate lane 与 run-browser-suite.mjs):选中图片节点 → 悬停「Marketing tools」→ 断言菜单在无点击情况下出现且焦点未进入菜单 → 指针移入菜单项断言未关闭 → 移出断言关闭 → 点击断言菜单打开且聚焦第一项 → Escape 关闭。
    • 修复前:同一用例在「hover 后菜单出现」处超时失败。
    • 当前:Selection toolbar opens on hover without stealing focus and still opens on click 通过。
  • npm test:1033 passed;check:browser-manifest、tsc --noEmit、vite build 通过;context_menu_dismissal 回归通过。

备注

  • 只影响画布选中操作条;画布右键菜单、助手面板等其它菜单未改动。

The node action bar required a click on every labelled menu (presets, marketing
tools, layout). Open it when the pointer rests on the label, keep it open while
the pointer travels into the menu, and close it when both are left.

A pointer-opened menu leaves focus on the label, so hovering never moves the
keyboard focus; a click still opens and focuses the first item as before. The
delays make a quick pass along the bar open only the label under the pointer.

Refs ThinkFlowLab#571
@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation type:feat New capability or behaviour labels Nov 29, 2026

@FayeSpica FayeSpica left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

image

@FayeSpica
FayeSpica merged commit 6e0b22a into ThinkFlowLab:main Nov 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:canvas Canvas, nodes and direct manipulation type:feat New capability or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants