MouseLeave Doesn't Fire When Covered By Active Object

Issue Type: Other
Impact: Moderate
Frequency: Constantly
Date Last Experienced: 2021-02-08 10:02:00 (-08:00)

Reproduction Steps:

  • Have a button or something that prints when MouseLeave is fired
  • While hovering over the button, make a GuiObject with Active = true appear over the button
  • MouseLeave doesn’t fire properly.

Expected Behavior:
I expect MouseLeave to fire since mouse input is now being sunk by the GuiObject over the top of it.

Actual Behavior:
MouseLeave doesn’t fire until the mouse completely leaves the active object.

I’ve included screenshots of this in a private message since the work isn’t yet released.

Workaround:
Technically this can be worked around by checking GetGuiObjectsAtPosition every frame to see if the currently hovered element is not the top-level one at the mouse’s position and then fire whatever function would normally be bound to MouseLeave, but it’s a gigantic pain to implement and not very performant.

2 Likes

You should be using GuiObject.InputEnded instead, MouseLeave does exactly what it’s supposed to do, and InputEnded is for when input has disconnected.

3 Likes