Relative Popup Perspective Via Script

Is there anyway to open a popup relative to the cursor via script? I’m trying to open a color picker for a table based on clicking on the cell. Only option that tells me what cell and row is clicked to confirm that the right option is clicked is ‘onSelectionChange’ but that doesn’t seem to give mouse cursor to do an ‘exact’ position.

Is relative position an option via script?


I believe the only way to get mouse cursor position in a script is via event properties (e.g. the clientX, clientY properties in an onClick mouse event’s event property).

I think you could move your logic from an onSelectionChange event to an onClick one and only fire if the table’s props.selection.selectedRow/Column match to get the functionality you’re looking for, although there will probably be some side-effects to work out.

Not at this time, no. Relative positioning was something which was requested as an edge case and so there is not yet a full parity between the scripting of a Popup and a Popup Action.

It will be awesome if a contextual menu could be added to perspective in a near future.

In the meantime, in order to try to achieve this feature, it will be usefull to be able to open popup with a relative position, close to the component clicked, with the ability to calculate the height of the popup according to the number of “menu” items.

We can use popup view action to open a popup with a relative Position, but in that case the height and other dimension of the popup view are constant…

+1, that’s another use case to try to mimic a contextual popup in perspective

Vision example to achieve in perspective…


Has this function been added since way back then?

No, relative positioning was never added to the popup functions.