1063
Views
15
Comments
Solved
Close popover menu
Question

We use a popover menu: when the icon is clicked the menu opens and shows a list of possible actions. We would like to have the menu closed once an action has been clicked. But the menu only closes once you click somewhere in the screen. Is it somehow possible to close the menu from within the action?


Regards,


John.

2026-02-26 06-29-24
Rahul
 
MVP
Solution

Hi John,

Use simple javascript inside your call action.


var x = document.getElementsByClassName("popover-bottom");
  x[0].style.display = "none";


Link for Demo Click Here


Hope this will help you.

Regards

Rahul Sahu

UserImage.jpg
Max Chia

Hi Rahul,


Thank you for the solution. I tried this in my project, and it does close the popover on click. However, after that I can't open the popover unless I click on other part of the page first. I know it's been almost 3 years since you gave this solution, but do you have any idea on why this behavior occurs?

UserImage.jpg
Marlon Calma

you can try do add this trick to solve the issue just run this javascript code "document.querySelector('body').click();"

2020-02-28 09-46-54
Eduardo Jauch

Hello John,

What type of application? Reactive, traditional web (I'm assuming it is not mobile)?
Also, what type of "popover" menu are you talking about? Is something from OutSystems UI, is a Forge compoenent, is just CSS?

Cheers!

2019-12-21 09-09-48
John Heutmekers

Hi Eduardo,


It's a reactive app, and it's the standard popover menu widget.

2026-02-26 06-29-24
Rahul
 
MVP
Solution

Hi John,

Use simple javascript inside your call action.


var x = document.getElementsByClassName("popover-bottom");
  x[0].style.display = "none";


Link for Demo Click Here


Hope this will help you.

Regards

Rahul Sahu

UserImage.jpg
Max Chia

Hi Rahul,


Thank you for the solution. I tried this in my project, and it does close the popover on click. However, after that I can't open the popover unless I click on other part of the page first. I know it's been almost 3 years since you gave this solution, but do you have any idea on why this behavior occurs?

UserImage.jpg
Marlon Calma

you can try do add this trick to solve the issue just run this javascript code "document.querySelector('body').click();"

2020-02-28 09-46-54
Eduardo Jauch

HI.

I think in this case the small JavaScript solution given by Rahul is the (only?) solution.

But I think this happens because this widget was not thought to enable "actions" to be executed. Just to show some extra information.

Wouldn't be better to use a Popup, for example? Or is the visual aspect that lead you decide to use the popover?

Cheers 

2019-12-21 09-09-48
John Heutmekers

Eduardo Jauch wrote:

HI.

I think in this case the small JavaScript solution given by Rahul is the (only?) solution.

But I think this happens because this widget was not thought to enable "actions" to be executed. Just to show some extra information.

Wouldn't be better to use a Popup, for example? Or is the visual aspect that lead you decide to use the popover?

Cheers 

Hi Eduardo,


The choice for a popover menu has indeed been taken for design reasons.

2021-03-18 21-03-15
Benjith Sam
 
MVP

Hi John,

I want to share one more solution for the above stated requirement.

Solution 2: 

see this sample: PopoverMenuDemo 


On the Screen Action flow introduce an JS node with below script.

$('.popover-background-window').click();


Hope this helps you!


Regards,

Benjith Sam

UserImage.jpg
Rupa Radhika Jahnavi Sagi

Benjith Sam wrote:

Hi John,

I want to share one more solution for the above stated requirement.

Solution 2: 

see this sample: PopoverMenuDemo 


On the Screen Action flow introduce an JS node with below script.

$('.popover-background-window').click();


Hope this helps you!


Regards,

Benjith Sam

 Hai Sam,

When I'am trying to use the script which you suggested , it is throwing an error.I have attached the oml can you please help me with the error that occurs on button click of pop-over menu??

 

Sample.oml
2021-03-18 21-03-15
Benjith Sam
 
MVP

Jahnavi Sagi wrote:

Hai Sam,

When I'am trying to use the script which you suggested , it is throwing an error.I have attached the oml can you please help me with the error that occurs on button click of pop-over menu??

Hi Jahnavi,

I didn't found any mistake in your implementation, could you please share the JS error message which you are facing. see this PopoverMenuDemo Sample

Please find the attached .oml file


Hope this helps you!


Regards,

Benjith Sam

Sample1.oml
UserImage.jpg
Rupa Radhika Jahnavi Sagi

Hi Sam,

I'am getting the above error when Iam trying to use the close script function which you shared,Could you help me with this?

2021-03-18 21-03-15
Benjith Sam
 
MVP

Jahnavi Sagi wrote:

Hi Sam,

I'am getting the above error when Iam trying to use the close script function which you shared,Could you help me with this?

Hi Jahnavi,

The error occurred because your application is not having/referring the jQuery script/definitions file. Please follow any one of the below mentioned solution (solution 2 is the preferred one)

Solutions:

1) Add the jQuery Script file to the Screen or to the Application Module in the Required Script section as per your requirement (referenced from OutSystemsUI Module)

2) Use pure JavaScript as mentioned below

document.getElementsByClassName('popover-background-window')[0].click();


Hope this helps you!


Regards,

Benjith Sam

UserImage.jpg
Rupa Radhika Jahnavi Sagi

Benjith Sam wrote:

Jahnavi Sagi wrote:

Hi Sam,

I'am getting the above error when Iam trying to use the close script function which you shared,Could you help me with this?

Hi Jahnavi,

The error occurred because your application is not having/referring the jQuery script/definitions file. Please follow any one of the below mentioned solution (solution 2 is the preferred one)

Solutions:

1) Add the jQuery Script file to the Screen or to the Application Module in the Required Script section as per your requirement (referenced from OutSystemsUI Module)

2) Use pure JavaScript as mentioned below

document.getElementsByClassName('popover-background-window')[0].click();


Hope this helps you!


Regards,

Benjith Sam



 

 Thank you Sam, It helped us.

2025-03-19 07-39-30
Rifaz

Hi john,

In Popover menu, Inside the bottom content placeholder. I think you are having Link widget for the list of actions. Use Container Onclick event instead of link widget. This will resolve the double click issue and popover menu will close automatically once you click on the container.

Best Regards,

RifazHussain M

2024-07-18 01-50-28
Daliah Daud

Hi @Rahul Sahu ,

How to disable onclick after click popover menu? 

After clicking menu retract it, a pop-up will appear. The issue is that when I click the button in the pop-up, it triggers the closure of the popover menu, causing the action associated with the button to activate only after a second click. Can you help me resolve this? 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.