Chat is not returned in UserInputService:GetFocusedTextBox()

After an update a few days ago, the chat bar is no longer returned in a call to UserInputService:GetFocusedTextBox(), even when the player is typing in it. I have a few games that are experiencing issues with keybinds false-firing whilst they are chatting due to this change.

It can be reproduced in any LocalScript:

local userInputService = game:GetService("UserInputService")

while true do
	task.wait(.5)
	print(userInputService:GetFocusedTextBox())
end

Whilst typing in chat, you should see nil outputting repeatedly in the console. This was not the behavior before.

Expected behavior is that when the chat box is focused (player is typing in the chat bar), it should return the chat bar TextBox when calling UserInputService:GetFocusedTextBox() like it did before.

The workaround at the moment seems to be relying on the “processed” argument to UserInputService.InputBegan, but there are use-cases where this is not appropriate to rely on and the aforementioned method of checking the focused text box makes more sense.

2 Likes
1 Like

Duplicate of UserInputService:GetFocusedTextBox() returns nil with the chat box focused - #3 by fxep1 .

3 Likes