MouseLeave doesn't fire if you move mouse fast

This is also effecting a game that I am currently working on, any updates/eta??

2 Likes

Still happening almost 2 months later with no ETA :frowning:

You should make sure to check the release notes every week.

https://wiki.roblox.com/index.php?title=ReleaseNotes/345

Once the “Pending” turns into “Live”, you should be able to see improvements on MouseLeave behavior (and the other events listed there).

You can subscribe to release notes by setting the notification level to “Watching First Post” in the #public:Release-Notes category.

5 Likes

Thank you so much! Didn’t see this.

1 Like

Still a (big) issue for me as well. Only happens when multiple buttons are close to each other and moving the mouse fast. I notice it in my games and others. This issue can really confuse players in the UI. Still shows “pending” in the release notes, many months later. :frowning:

1 Like

This bug is expected to be fixed when the new UI backend system goes live which will hopefully be sometime this week.

No, that is a separate fix that @darthskrill has been trying to ship.

1 Like

With any luck I will turn this on this week and this bug will go away. No promises though!

4 Likes

Did you have any luck? I’m still getting this issue massively so I’m going to assume you encountered another issue.

2 Likes

The fix is now live for desktop (PC/Mac). Will be live for mobile later this week most likely.

6 Likes

Yay it’s finally fixed, many thanks from all of us.

Also, if you have the latest version of the mobile client on iOS or Android it should also work there.

Not to be the guy that brings up an old thread, but your fix doesn’t seem like it did anything at all. In fact, I thought you guys were still working on the fix.

In my game, MouseEnter and MouseLeave behave like they have for years: unreliably. You can move the mouse quickly around the buttons in my menu and see that the event clearly is not firing properly:

Is there anything else that can be done about this?

2 Likes

It seems that there’s a bug where if you move the mouse quickly from one button to another, the new button will fire MouseEnter before the old button fires MouseLeave. If you have a system where you have a variable storing the currently hovered button, this will cause the following behavior:

  • You’re hovering button A.
  • You move the hover to button B.
  • B.MouseEnter fires, you set hoveredButton to B.
  • A.MouseLeave fires, you set hoveredButton to nil.
  • hoveredButton is now nil despite B still being in the hover state.

We’ll look into fixing it.

2 Likes

A fix would be greatly appreciated! My game uses animations that rely on that and it would just look better if they worked more often

It looks like for your particular game, this isn’t the issue.

There are calls to TweenSize for MouseEnter and Leave, and the override boolean is set to false. If you set this to true, it works. This is because without setting override, the tweens can run simultaneously and the state gets messy. I’d also recommend using TweenService instead as the old Tween methods will be deprecated in the future.

8 Likes

Cool. I had no idea it was my fault this was happening. I’m glad I can fix it.

1 Like

Thanks for the advice! I was stuck on this for a whole month, but the whole time I had override set to true! You helped me fixed my game!

Sorry for the necropost, but it appears I’m having an issue similar to that of MouseEnter being called before MouseLeave when dragging the mouse quickly to another ui element.

Sure, I could reorient my code to a solution that does not depend on MouseLeave to be called on the first ui element before MouseEnter is called on the second ui element, but it should be expected that your mouse leaves the first element before entering the second element.

The error shown in a GIF: (Description menu not popping up)
Error

What I get:
image
What I expect to get:
image

As a little repro as to the GIF above in a much simpler environment, you can see the attached place file and gif:
ErrorRepro.rbxl (22.0 KB)
Error2

5 Likes

I’ve not had issues with using Mouse detection events on UIObjects for a long time, so I was surprised to see this was happening again. However, using your repro, I added colour indicators to the frames which appears to be displaying as expected, but the indicator frame doesn’t turn visible.