Is your feature request related to a problem? Please describe.
This issue is a subset of #321
Problem
Currently, our context menu implementation requires DOM-focused elements as triggers. This becomes problematic when working with:
- Canvas elements with virtual interactive areas
- Components where the context menu shouldn't own the mount point of the trigger element
- Scenarios requiring programmatic context menu activation from arbitrary locations
Describe the solution you'd like
Exposing the trigger logic as a hook, providing a registration pattern to connect external triggers to context menus
The approach allows developers to:
- Trigger context menus from canvas-based interfaces
- Open menus programmatically from any component
- Maintain separation of concerns between UI elements and context menu behavior
Describe alternatives you've considered
We could instead try and hoist all logic and nuance into a state hook above the root context menu node but that would couple all Menu and their child context components together. The solution above allows for us to leverage all existing nuance with minimal code changes.
Additional context
We're using a canvas component that should trigger the context menu where we don't control the mount of the canvas (and it doesn't make sense for the context menu to own the mounting of the cavas components)
Is your feature request related to a problem? Please describe.
This issue is a subset of #321
Problem
Currently, our context menu implementation requires DOM-focused elements as triggers. This becomes problematic when working with:
Describe the solution you'd like
Exposing the trigger logic as a hook, providing a registration pattern to connect external triggers to context menus
The approach allows developers to:
Describe alternatives you've considered
We could instead try and hoist all logic and nuance into a state hook above the root context menu node but that would couple all Menu and their child context components together. The solution above allows for us to leverage all existing nuance with minimal code changes.
Additional context
We're using a canvas component that should trigger the context menu where we don't control the mount of the canvas (and it doesn't make sense for the context menu to own the mounting of the cavas components)