Calling `TextBox:CaptureFocus()` within a `FocusLost` event causes an infinite focus/unfocus loop

I’m trying to force a TextBox to keep focus as the user clicks other buttons by calling CaptureFocus() immediately inside a FocusLost event. This causes the client to enter some kind of infinite loop where the keyboard opens and closes every frame and the whole client locks up.

The code is very simple. It just looks like this:

textBox:CaptureFocus()
textBox.FocusLost:Connect(function()
    textBox:CaptureFocus()
end)

I’ve tested this on PC and iOS and so far it only happens on iOS. I haven’t tested on Android.

Expected behavior

I expect the keyboard to stay on screen when the TextBox tries to lose focus.

3 Likes

Hi @grilme99,

We’ve fixed the infinite loop that occurs in situations like this one. Can you please check on either iOS or Android?

Update: the fix caused some other issue, so we’re reverting it back, no need to check anything for now

Hi @grilme99 ,

We believe we’ve fixed it for real this time. Can you please check?