Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Detecting when element loses focus and hide it / mouse moves off / mouse position

I'd like to detect when an element loses focus, mouse move off,......


I have a tree-view navigation using a gallery. It becomes visible by clicking on an icon outside the gallery. And I'd like it to become invisible again when the mouse moves outside.


This should be easy, right - but I suspect it isn't, the user has to click somewhere to make this happen.


The best solution I could come up with is to cover the rest of the app with a transparent rectangle and hide the gallery when the user clicks there.

It works but feels a little awkward - I'd like to pass the click, OnSelect, on to elements "under" the rectangle. As it is now one can be led to think the semi-obscured elements are clickable when they aren't. I'm not sure if this would be a big deal for users? My initial reaction was - oh, I have to click again.


The other alternative I can think of is to set the visible property of the navigation gallery to false in every other clickable item sharing the same screen. But that seems like a pain.


Any other suggestions? Feels like there should be a better way...



Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,261)