I've been using this function to toggle popups in my Perspective session.
system.perspective.togglePopup(id=id, view=popup_view_path, showCloseIcon=False, draggable=False, resizable=False, overlayDismiss=True)
For some reason, even though overlayDismiss is set to True, the popups that are opened using this function do not close when I click outside of them.
The docs for the togglePopup
function state that the overlayDismiss
parameter:
Will allow the user to dismiss and close a modal popup by clicking outside of it if True. Defaults to False
Perhaps, try setting modal = True
as well.
2 Likes
I see. So for a non-modal popup, to replicate this logic I assume for the root container I would just program an onClick event to run closePopup.
You could definitely do that. But if you want the functionality of the modal, there's really no reason to reinvent the wheel with the parameters already built in for you.
That would work, but I want the user to have the ability to interact with other elements while the popup is open. Since the popup is mostly transient and just displays help information, if the user's focus shifts to another element, I want the popup to close itself rather than inconveniencing the user by forcing them to close it themselves.