Skip to content

Conversation

@totallytavi
Copy link

@totallytavi totallytavi commented Sep 19, 2025

Roblox has recently introduced a change that results in ContextActionService ignoring chat inputs. CoreGui is made nil, so CAS won't properly detect that the events are game processed events.

See this DevForum thread: https://devforum.roblox.com/t/userinputservicegetfocusedtextbox-returns-nil-with-the-chat-box-focused/3940424

Minimum reproducible example

Since CodeRabbit is so angry I didn't do this.

local UserInputService = game:GetService("UserInputService")
local TextChatService = game:GetService("TextChatService")

UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
	if input.KeyCode ~= Enum.KeyCode.Quote then
		return
	end
	
	print(
		'Quote key processed',
		gameProcessedEvent and "GPE" or "Non-GPE",
		TextChatService.ChatInputBarConfiguration.IsFocused and "Focused" or "Not-Focused",
                UserInputService:GetFocusedTextBox() and "Textbox" or "No-Textbox"
	)
end)
image

Summary by CodeRabbit

  • Bug Fixes
    • Improved keyboard input handling across UI themes: console toggle and key-driven panels now ignore input when chat or text boxes are focused, preventing unintended toggles.
    • Tab and other key interactions for player list, settings, and user panel now respect chat input focus and game-processed events for more reliable behavior.

@totallytavi totallytavi changed the title Ensure console respects chat Ensure console keybind respects chat Sep 19, 2025
@ari-party
Copy link

local textbox = service.UserInputService:GetFocusedTextBox()

local textbox = service.UserInputService:GetFocusedTextBox()

local textbox = service.UserInputService:GetFocusedTextBox()

local textbox = service.UserInputService:GetFocusedTextBox()

@totallytavi
Copy link
Author

Thanks for pointing out the ones I missed @ari-party. I'll submit some more fixes for this later

@GalacticInspired
Copy link
Member

GalacticInspired commented Oct 4, 2025

Wasn't this already fixed by simply checking gameProcessedEvent?
#1984

@totallytavi
Copy link
Author

Potentially, let me see.

@GalacticInspired
Copy link
Member

Potentially, let me see.

Hi, have you managed to check this out yet?

@totallytavi
Copy link
Author

I opened a baseplate and had a weird issue with Adonis. I'll see if I can make a reproducible example

@totallytavi
Copy link
Author

totallytavi commented Oct 22, 2025

@GalacticInspired
Seems to fix it, since Roblox will mark the event as a gameProcessedEvent. I don't trust that Roblox will keep this so just for safety, I'll implement both GPE and IsFocused in my PR
image

local UserInputService = game:GetService("UserInputService")
local TextChatService = game:GetService("TextChatService")

UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
	if input.KeyCode ~= Enum.KeyCode.Quote then
		return
	end
	
	print(
		'Quote key processed',
		gameProcessedEvent and "GPE" or "Non-GPE",
		TextChatService.ChatInputBarConfiguration.IsFocused and "Focused" or "Not-Focused"
	)
end)

@totallytavi
Copy link
Author

As @ari-party pointed out, #1984 didn't account for a few other UIs so I'll drop that into my PR as well

coderabbitai[bot]

This comment was marked as spam.

* Ensure textbox is a boolean in checks
* Add fallback of false for all checks
* Add gameProcessedEvent to checks
* Add logic to check for all instances needed
* Add fallback in the event none exist
* Remove unneeded "or false" from textbox check
@Dimenpsyonal Dimenpsyonal added the 🎏 miscellaneous Miscellaneous content label Nov 3, 2025
Copy link
Contributor

@Expertcoderz Expertcoderz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just some minor issues. I'm not exactly sure if this PR should be merged (considering that the underlying issue has been fixed by #1984), so I'll leave it open for others to comment.

BindEvent(service.UserInputService.InputBegan, function(InputObject, gameProcessedEvent)
local textbox = service.UserInputService:GetFocusedTextBox()
if not textbox and not gameProcessedEvent and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
local textbox = service.UserInputService:GetFocusedTextBox() ~= nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming textbox to textboxFocused for clarity.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do that. VSC can probably search and replace

local textbox = service.UserInputService:GetFocusedTextBox()
if not textbox and not gameProcessedEvent and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
local textbox = service.UserInputService:GetFocusedTextBox() ~= nil
local chatFocused = service.TextChatService and service.TextChatService.ChatInputBarConfiguration and service.TextChatService.ChatInputBarConfiguration.IsFocused or false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using service.TextChatService:FindFirstChildOfClass("ChatInputBarConfiguration") to get the ChatInputBarConfiguration instance. ChatInputBarConfiguration is not a property of TextChatService, but rather a child instance under TextChatService.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it can be renamed

local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and InputObject.UserInputType==Enum.UserInputType.Keyboard and InputObject.KeyCode == Enum.KeyCode.Tab then
service.UserInputService.InputBegan:Connect(InputObject, gameProcessedEvent)
local textbox = service.UserInputService:GetFocusedTextBox() ~= nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as the first comment: rename textbox to textboxFocused.

if not (textbox) and InputObject.UserInputType==Enum.UserInputType.Keyboard and InputObject.KeyCode == Enum.KeyCode.Tab then
service.UserInputService.InputBegan:Connect(InputObject, gameProcessedEvent)
local textbox = service.UserInputService:GetFocusedTextBox() ~= nil
local chatFocused = service.TextChatService and service.TextChatService.ChatInputBarConfiguration and service.TextChatService.ChatInputBarConfiguration.IsFocused or false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as the second comment: use :FindFirstChildOfClass() to get the ChatInputBarConfiguration.

gTable.BindEvent(service.UserInputService.InputBegan, function(inputObject: InputObject, gameProcessedEvent)
local textbox = service.UserInputService:GetFocusedTextBox()
if not textbox and not gameProcessedEvent and rawequal(inputObject.UserInputType, Enum.UserInputType.Keyboard) and inputObject.KeyCode.Name == (Variables.CustomConsoleKey or consoleKey) then
local textbox = service.UserInputService:GetFocusedTextBox() ~= nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider applying the same changes suggested in the first and second comments, for the rest of the files.
(Yeah, it's kinda sad how adonis has lots and lots of duplicated code across the UI themes. We should fix this someday.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Fix someday = until roblox inevitably breaks it or someone comes up with a genius solution at 1AM)

@Epix-Incorporated Epix-Incorporated deleted a comment from coderabbitai bot Dec 18, 2025
@GalacticInspired GalacticInspired marked this pull request as draft December 18, 2025 13:17
@GalacticInspired
Copy link
Member

Please submit this PR again once requested changes have been made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎏 miscellaneous Miscellaneous content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants