[4.25.2] Hover UI detection

I have a bool in the playercontroller that tracks when the player mouse is hovering over visible UI elements
I use OnMouseMove() to set the bool to true, and and OnMouseLeave() to set the bool to false.
This is the only time the bool is set.

I have debug messages that display whether the bool is true or false, and it seems to be working. So long as I don’t click a mouse button.
When hovered over a visible UI element the bool is correctly displayed as true, but when I click any mouse button while hovered over a visible UI element, the bool switches from true to false.

I have a number of commands for the player that I don’t want to be triggered while the players mouse is over the UI, and this is preventing me implementing this limit.
Does anyone know what could be causing this?

EDIT: I resolved my issue by adding a bool that tracks OnMouseDown() and then resetting the new bool in OnMouseLeave()
OnMouseDown() sets bIsHoveredMouseDown to true
In OnMouseLeave(), if bIsHoveredMouseDown = true, then bHoveringMouseDown is immediately set to false
In OnMouseLeave(), bIsNotHovereing bool is only reset if bHoveringMouseDown is false when OnMouseLeave() is called
This prevents OnMouseDown() from reseting my bIsNotHovereing bool, while allowing normal OnMouseLeave() calls to reset the bool.

While I got it working, I still don’t know why clicking a mouse button calls the OnMouseLeave() event. any ideas to this would be still be helpful.