# Modal not working properly?

**URL:** <https://community.weweb.io/t/modal-not-working-properly/5095>\
**Category:** Ask us anything\
**Created:** [October 27, 2023, 6:07pm UTC](https://community.weweb.io/t/modal-not-working-properly/5095 "2023-10-27T18:07:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![luka](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/luka/32/1571_2.png) [@luka](https://community.weweb.io/u/luka)\
**Post date:** [November 3, 2023, 10:57am UTC](https://community.weweb.io/t/modal-not-working-properly/5095/5 "2023-11-03T10:57:58Z")

</div>

add this when opening the modal:

```auto
if (context.browser?.["environment"] != "editor") {
  wwLib.getFrontDocument().body.style.overflow = "hidden";
  wwLib.getFrontDocument().documentElement.style.overflow = "hidden";
}

```

and this when closing the modal

```auto
if (context.browser?.["environment"] != "editor") {
  wwLib.getFrontDocument().body.style.overflow = "auto";
  wwLib.getFrontDocument().documentElement.style.overflow = "auto";
}

```

this will only apply in the published app, if you want to test it in editor remove the if part

---

_[View the full topic](https://community.weweb.io/t/modal-not-working-properly/5095)._
