# Very long delay in making an element not visible \[BUG\]

**URL:** <https://forum.bubble.io/t/very-long-delay-in-making-an-element-not-visible-bug/232424>\
**Category:** Plugin builders\
**Created:** [November 14, 2022, 11:09am UTC](https://forum.bubble.io/t/very-long-delay-in-making-an-element-not-visible-bug/232424 "2022-11-14T11:09:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [November 14, 2022, 11:09am UTC](https://forum.bubble.io/t/very-long-delay-in-making-an-element-not-visible-bug/232424/1 "2022-11-14T11:09:09Z")

</div>

Hey everyone,

I am experiencing a really nasty bug when making my plugin element “not visible”. I’ve got my plugin element that has its visibility based on a state (when the state is “yes” it is visible). When a button is clicked, the state becomes “no” and so the element knows not to be visible. (Bubble uses the css property “visibility” which is a pseudo-transitionable element, so I believe this is the root of the issue).

I am experiencing a huge bug where when the state is no it sometimes **takes up to 2 seconds for it to become invisible.** You might say, hey, just check for the bubble.is\_visible() property and run some code based off of that. Well …

THE BIG PROBLEM: When the visibility property changes, the update function does not run …

**Let me repeat that: when the visibility property goes from yes to no, or no to yes, the update function does not run 😕**

Therefore, there is no straightforward way for a bubble developer to run any code based on the visibility property. This is a huge problem for me and I assume for many plugin devs.

Does anyone know of any workaround?

---

<div class="post-metadata">

**Author:** ![bubble.trouble](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@bubble.trouble](https://forum.bubble.io/u/bubble.trouble)\
**Post date:** [November 14, 2022, 4:39pm UTC](https://forum.bubble.io/t/very-long-delay-in-making-an-element-not-visible-bug/232424/2 "2022-11-14T16:39:07Z")

</div>

Just add your own event handler to the page and trigger/respond to that event. I recently started to think this approach should be used by all plugin builders, relying only on Bubble provided functionality only as needed.

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [November 14, 2022, 5:33pm UTC](https://forum.bubble.io/t/very-long-delay-in-making-an-element-not-visible-bug/232424/3 "2022-11-14T17:33:49Z")

</div>

I had to use a Mutation Observer 🤦‍♂️

Thanks for the tip @bubble.trouble

For anyone who faces this issue, please use the following method to be able to tell when the visibility property changes on a given element. Run it inside your initialize function.

> **[GitHub - keithclark/ComputedStyleObserver: Prototype implementation of a...](https://github.com/keithclark/ComputedStyleObserver)**
>
> Prototype implementation of a \`computedStyle\` observer for DOM elements - GitHub - keithclark/ComputedStyleObserver: Prototype implementation of a \`computedStyle\` observer for DOM elements
