-
-
Notifications
You must be signed in to change notification settings - Fork 223
Ensure console keybind respects chat #1989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
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? |
|
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 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 |
* 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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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)
|
Please submit this PR again once requested changes have been made. |

Roblox has recently introduced a change that results in
ContextActionServiceignoring 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.
Summary by CodeRabbit