# overlayDismiss not working for togglePopup

**URL:** <https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 20, 2024, 4:49pm UTC](https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109 "2024-12-20T16:49:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noah\_Gilgo](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Noah\_Gilgo](https://forum.inductiveautomation.com/u/Noah_Gilgo)\
**Post date:** [December 20, 2024, 4:49pm UTC](https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109/1 "2024-12-20T16:49:53Z")

</div>

I've been using this function to toggle popups in my Perspective session.

```python
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.

---

<div class="post-metadata">

**Author:** ![ryan.perretta](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.perretta/32/75110_2.png) [@ryan.perretta](https://forum.inductiveautomation.com/u/ryan.perretta)\
**Post date:** [December 20, 2024, 5:06pm UTC](https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109/2 "2024-12-20T17:06:51Z")

</div>

The [docs](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-togglePopup#parameters) 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.

---

<div class="post-metadata">

**Author:** ![Noah\_Gilgo](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Noah\_Gilgo](https://forum.inductiveautomation.com/u/Noah_Gilgo)\
**Post date:** [December 20, 2024, 5:12pm UTC](https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109/3 "2024-12-20T17:12:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ryan.perretta](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.perretta/32/75110_2.png) [@ryan.perretta](https://forum.inductiveautomation.com/u/ryan.perretta)\
**Post date:** [December 20, 2024, 5:16pm UTC](https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109/4 "2024-12-20T17:16:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Noah\_Gilgo](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Noah\_Gilgo](https://forum.inductiveautomation.com/u/Noah_Gilgo)\
**Post date:** [December 20, 2024, 8:23pm UTC](https://forum.inductiveautomation.com/t/overlaydismiss-not-working-for-togglepopup/100109/5 "2024-12-20T20:23:33Z")

</div>

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.
