With the recently added custom context menus
It works on right click, but you can't do that on mobile. Press/Hold probably would do it (haven't tried, but guessing), but that wouldn't work for certain components
It would be nice if you could trigger a custom context menu on a button (or icon) left click as well.
That way you can essentially create what feels like a context menu for something like a table, but have a dedicated place to trigger it.
Currently this would be done with a popup and a bunch of CSS to make it feel like a context menu, hitting the native functionality would be nice.
If you have a reference to the component in a script, try
requestContextMenu, with no arguments.
Perfect! Sort of. Is it possible to make it show up at the click location by chance?
Reason I ask, is say I want to add my table context items to a button, I would want them to show up on the button.
Theoretically I could just put them on the button, but then I need to add some extra infrastructure in place to send all the messages over to the table and receive them there. Not the end of the world, would just make it a bit cleaner if it inherently requested the context menu at the mouse location.
Also, helps if you trigger it on a really large button like this, would probably make more sense to show up underneath your mouse instead of in the center of the button.
A couple proposed solutions to this btw:
- Optional coords:
- Automatically grabbing those coords when this function is called if they are available in that scope