InputEnded should fire when an element is hidden

I have two states (hover and unhover) bound to InputBegan and InputEnded.
When I disable and re-enable the GUI, InputEnded won’t fire on the element so it still thinks I’m hovering:
This is also occurs with the Visible property.

InputEnded should fire for every descendant and the object itself when it is hidden.

Repo:

  • Create a ScreenGui and a Frame inside it
  • Bind two functions to InputBegan and InputEnded MouseMovement that print something
  • Create some way to toggle the Frame’s/ScreenGui’s visibility without ending MouseMovement input on the frame (keybind?)
  • Play the test and you should see that InputEnded does not fire when you hide the ScreenGui/Frame, and also doesn’t when you do something that should end the input (presumably because it has stopped listening for any input changes?)
2 Likes

I agree, although would it be possible for you to set up a listener for the GUI’s Visible property? Input events have always been sort of unreliable, including not firing when the mouse leaves the game window sometimes or if the mouse moves too fast to register, they’re overdue for some improvements.

1 Like

It’s not just Visible of the object, it’s Visible for all of the object’s ancestors and the Enabled property of its ancestor ScreenGui.

If it were just one object (e.g. the element itself) it wouldn’t be a big issue, but it’s potentially a lot more than that.
This’ll just end up spamming Visible/Enabled listeners and then to mitigate the effects of that I’ll need to start globalising the listeners – and if I wasn’t using a single UI input module, I’d also need to make some sort of weird system to handle that across scripts.