Skip to content

Fix/378 right click context menu sometimes directly places selection node#379

Merged
felix-schultz merged 2 commits intodevfrom
fix/378-right-click-context-menu-sometimes-directly-places-selection-node
Nov 13, 2025
Merged

Fix/378 right click context menu sometimes directly places selection node#379
felix-schultz merged 2 commits intodevfrom
fix/378-right-click-context-menu-sometimes-directly-places-selection-node

Conversation

@felix-schultz
Copy link
Copy Markdown
Member

This pull request introduces a mechanism to prevent accidental selection of context menu items immediately after the menu opens, improving the user experience and reducing unintended actions. The main changes involve adding a blocking reference to manage click events, refactoring event handlers to respect this block, and updating component props to pass the blocking state.

Context menu interaction improvements:

  • Added a menuBlockedRef to both FlowContextMenu and FlowContextMenuNodes components, which temporarily blocks menu item selection for 200ms after the menu opens to prevent accidental triggers. (packages/ui/components/flow/flow-context-menu.tsx, packages/ui/components/flow/flow-context-menu-nodes.tsx) [1] [2]
  • Refactored all menu item handlers (onClickonSelect) to check menuBlockedRef.current and prevent selection if the block is active, ensuring consistent behavior across all context menu actions. (packages/ui/components/flow/flow-context-menu.tsx, packages/ui/components/flow/flow-context-menu-nodes.tsx) [1] [2] [3] [4]
  • Updated prop signatures and usage to pass menuBlockedRef through nested context menu components, maintaining the blocking state throughout the menu hierarchy. (packages/ui/components/flow/flow-context-menu-nodes.tsx, packages/ui/components/flow/flow-context-menu.tsx) [1] [2]

Code quality and minor improvements:

  • Switched to using useCallback for handleNodePlace to optimize performance and ensure consistent function references. (packages/ui/components/flow/flow-context-menu.tsx)
  • Minor style adjustment: changed the context menu content height class for improved layout consistency. (packages/ui/components/flow/flow-context-menu.tsx)

@felix-schultz felix-schultz merged commit 529b916 into dev Nov 13, 2025
3 of 10 checks passed
@felix-schultz felix-schultz deleted the fix/378-right-click-context-menu-sometimes-directly-places-selection-node branch November 13, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Right click context menu sometimes directly places selection / node

1 participant