Is there a click-away event?

I have implemented a simple menu that slides in from the left when a menu icon is clicked in the header. Here’s a piece of the open menu:

image

On page load, the menu is hidden. When the menu is open, clicking its menu icon causes the menu to slide left, out of sight. (I assume this means it is transitioned back to being hidden but I’m not certain.)

My problem is that when the menu is open, I want it to close when the user clicks anywhere outside the menu group. In fact, when the menu is open, only covering part of the left side of the app window, I want all elements other than the menu to be disabled. Then, if the user clicks anywhere in the app other than in the menu, trigger the menu icon clicked event to close the menu.

In a sense, I want the menu to behave somewhat like a popup group.

Is there such a thing as a click-away event and a way to protect all visible elements while the menu is open?

The group focus is an element that must be shown via workflow, and clicking anywhere outside of it will hide it. Try experimenting with that instead of a regular group for your menu.

The group focus does need a “reference element” so it’ll be positioned relative to that element.

2 Likes

I don’t think Group Focus is exactly what I want. It sounds like it doesn’t support the kind of animation I have, based on your tutorial for a sliding menu.

Here’s what I did:

Create group the full width of the page. It is white and 50% opaque. This is a mask that prevents access to the page elements but responds to a click to close the open menu and hide itself.

The opened menu is pulled in front of the mask so the mask can be full-width on the page.

Here’s the workflow for the mask:

There are corresponding actions for when the opened and closed menu icons are clicked.

I don’t know if the Group Focus would have worked, but this solution was quick and easy and so far works well. However, I don’t know what problems may crop up with responsiveness. We’ll see.

i think thats bad ux to have to click twice/ close menu-> perform another action.
https://ux.stackexchange.com/search?q=close+menu ,
maybe you can try implement this Functionality of menu expanding with other elements to a group focus.

There are no extra clicks.

Click an icon to open a menu:

  • Click a menu item to take an action
    Normally go to another page.
    Upon return, the menu is closed.

  • If user decides to not select an action from the menu,
    click somewhere to close the menu. This is either an icon in the menu group or anyplace outside the menu.
    The result is that the menu closes and user can continue to work on the current page.

No extra clicks.

seems like extra click to me :smirk:

The only other option I could think of If you really don’t want to use the menu that bubble has or the focus group is to add a large invisible group that covers the whole screen where the menu is inside of. Then maybe on click of the large invisible group the menu can hide. Definitely not what I would normally do but just throwing it out there.

Example: https://805menu.bubbleapps.io/version-test?debug_mode=true

The invisible group is exactly what I’ve chose to use until something better comes along.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.