# Delay when moving mouse outside of pop-over

**URL:** <https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388>\
**Category:** Ask the community\
**Tags:** ui\
**Created:** [March 31, 2023, 11:32am UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388 "2023-03-31T11:32:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SinanMaric](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sinanmaric/32/1226_2.png) [@SinanMaric](https://community.appfarm.io/u/SinanMaric)\
**Post date:** [March 31, 2023, 11:32am UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388/1 "2023-03-31T11:32:23Z")

</div>

I have added an event handler “on right click” on a container, it opens a pop-over. Additionally, I want a 2 second delay on close; when the user is moving the mouse outside of the pop-over. I am struggling to implement this 2 second delay. Do you have any solutions for this?

---

<div class="post-metadata">

**Author:** ![Mari](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/mari/32/934_2.png) [@Mari](https://community.appfarm.io/u/Mari)\
**Post date:** [March 31, 2023, 11:46am UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388/2 "2023-03-31T11:46:38Z")

</div>

Hi! If I understand your case correctly, this might work:

1. Set up a container in your popover with the content of the popover inside it
2. Set up an action “on hover end” on that container. In the action, set up an action node “sleep” with a value of 2000 before the “close popover” action node.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![SinanMaric](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sinanmaric/32/1226_2.png) [@SinanMaric](https://community.appfarm.io/u/SinanMaric)\
**Post date:** [March 31, 2023, 11:59am UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388/3 "2023-03-31T11:59:30Z")

</div>

Sorry, I may have formulated the problem badly.

The problem we are facing is that we want the container not to close should the user move the mouse back to the container within two seconds, is there any way to achieve this?

---

<div class="post-metadata">

**Author:** ![Sondre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sondre/32/105_2.png) [@Sondre](https://community.appfarm.io/u/Sondre)\
**Post date:** [March 31, 2023, 12:50pm UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388/4 "2023-03-31T12:50:06Z")

</div>

Hi,

I think this can be solved by checking if the boolean valute tracking “on hover” is true after the sleep and closing the popover if it is not. In this case it is important to run the “on hover start” and “on hover end” i parallell.  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/fa3f2a47f88e30d5e38e8c91da873033850faa2d.png)

---

<div class="post-metadata">

**Author:** ![SinanMaric](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sinanmaric/32/1226_2.png) [@SinanMaric](https://community.appfarm.io/u/SinanMaric)\
**Post date:** [March 31, 2023, 1:21pm UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388/5 "2023-03-31T13:21:33Z")

</div>

Thanks! But how can I check if the boolean value tracking “on hover” is true? And should this be checked with an if node in the action?

---

<div class="post-metadata">

**Author:** ![Sondre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sondre/32/105_2.png) [@Sondre](https://community.appfarm.io/u/Sondre)\
**Post date:** [March 31, 2023, 1:40pm UTC](https://community.appfarm.io/t/delay-when-moving-mouse-outside-of-pop-over/388/6 "2023-03-31T13:40:47Z")

</div>

You can use a runtime boolean “Hover” variable, either in appvariables or on the datasource object in context.  
“on hover start” updates the boolean to true.  
“on hover end” updates tha boolean to false → sleeps for 2000 ms → If(“hover”) !=true -\>close popover

With these to running in parallell the boolean “hover” will allways keep track if you hover or not so “the close popover” will only close if the cursor is still outside of the popover 🙂 And the close popover should be inside an if statement checking to boolean “hover” !=true
