Ensure console keybind respects chat
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)
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.
https://github.com/Epix-Incorporated/Adonis/blob/2d505fed09b7c5eb9fe863bd601bafaa957c63f7/MainModule/Client/UI/Default/Settings.luau#L117 https://github.com/Epix-Incorporated/Adonis/blob/2d505fed09b7c5eb9fe863bd601bafaa957c63f7/MainModule/Client/UI/Aero/PlayerList.rbxmx#L361 https://github.com/Epix-Incorporated/Adonis/blob/2d505fed09b7c5eb9fe863bd601bafaa957c63f7/MainModule/Client/UI/Default/UserPanel.luau#L1056 https://github.com/Epix-Incorporated/Adonis/blob/2d505fed09b7c5eb9fe863bd601bafaa957c63f7/MainModule/Client/UI/Default/PlayerList.rbxmx#L346
Thanks for pointing out the ones I missed @ari-party. I'll submit some more fixes for this later
Wasn't this already fixed by simply checking gameProcessedEvent? https://github.com/Epix-Incorporated/Adonis/pull/1984
Potentially, let me see.
Potentially, let me see.
Hi, have you managed to check this out yet?
I opened a baseplate and had a weird issue with Adonis. I'll see if I can make a reproducible example
@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
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)
As @ari-party pointed out, #1984 didn't account for a few other UIs so I'll drop that into my PR as well
Please submit this PR again once requested changes have been made.