Mouseleave / Enter does not fire when crossing center of screen


#1

When the leftmost side of a UiButton is directly adjacent to the horizontal center of the screen, and the mouse is moved left over the center of the screen in one frame, MouseLeave will not fire. MouseEnter will not fire on subsequent re-entry of the button.

If the left side of the button is to the right of the center, the bug will only occur if the mouse is moved left fast enough to cross the center within one frame. If the mouse is moved back to the right half of the screen without touching the button, the button will no longer be highlighted.

If the left side of the button is to the left of the screen’s center, the bug will not occur at all.

Repro place: ButtonBugRepro.rbxl (14.4 KB)


#2

What a funny bug! I can confirm this. Some other info I uncovered looking into this:

  • This also occurs if the right-side of the button is touching the center line and you move the mouse left-to-right off of the button.
  • This includes all Gui objects, not just buttons.
  • Other events, like MouseMoved and Button1Down, still work as expected

#3

I just found it occurs on the opposite side as well, although for me the button needs to be moved an extra pixel to the left, so initially i thought that it didn’t occur on the opposite side (think this is just an artifact of my screen resolution in studio though)


#4

I’ve encountered a similar issue. MouseLeave seems to only fire when my mouse leaves from the left direction.


#5

If you are using a SurfaceGui (You never mention it, but going to state it anyways) it shouldn’t be parented to the object. Instead you should parent it to the PlayerGui and adornee it to the object. This helped ShoesForClues above me.