How to recreate the / key focusing the chat bar

Hello! If you’re using an us layout keyboard you probably wouldn’t have noticed this but roblox internally translates all keyboard inputs into us layout inputs for things like ContextActionService and UserInputService but through sheer dark magic the chat bar getting focused doesn’t seem to be effected by this!
When i hit shift + 7 (which produces / for my keyboard layout) the chat bar gets focused but when i do the same w an us layout keyboard it doesn’t as the output of an us layout keyboard is completely different.
How does the default chat script accomplish this? How can i get the raw input of a player rather than the processed input turned into the us layout services like ContextActionService and UserInputService seems to provide?

I wanna make it so when you type ‘/’ in your keyboard layout (not just the us layout) my custom chat’s TextBox gets focused.

Find out whatever ‘/’ on your keyboard is translated to and add that input to the list of inputs that correspond to the focus of the textbox being captured.

how’d i do that for every single keyboard layout?

There’s probably not too many mappings of the ‘/’ key to other keys that you need to account for.

Many languages have their own keyboard layout like french etc. not to mention there are layouts other than qwerty. I don’t think handling this problem manually is possible, for all I know the player might be using an obscure layout I’ve never heard about.

Besides how’d i detect the layout they’re using in the first place? I need the method the default chat uses for focusing.

I remembered a method called GetStringForKeyCode in UserInputService, it gets the exact location of the keybind on any keyboard ("/" for example). This can probably help you achieve this.