Today, we’re announcing the public release of our Lua library for gamepad and keyboard navigation helpers – Focus Navigation! This library was used to build our console app, and more recently, add support for keyboard + gamepad navigation on desktop and mobile.
We hope this library helps you build experiences that are more customized for different inputs and more accessible to users who prefer to use directional input for UI.
What Is It?
Focus Navigation is a library of helpers for building UI with more complex, app-like functionality that isn’t yet natively supported in the Roblox game engine. This includes things like restoring selection to a previous element after navigating away, having a default child object to select when selection enters a parent object, etc.
For example, this is how selection will behave when the useMostRecentOrDefault hook is used for the Home page and Details page :
Whereas this is how it will behave otherwise:
As you can see, this can help the user navigate to objects of interest, like an item tile or play button. It also helps eliminate unpredictable behavior (like selection going to the search bar on Home in the demo)!
You can find the repository here: focus-navigation! Check out the documentation for a full rundown of the library’s APIs.
Wait, There’s Gamepad Support on Mobile?
Yes! Snuck this one in here – right before the holidays, we enabled gamepad support on mobile (this includes phones and tablets) and keyboard support for Android. We’re working through some native issues for keyboards on iOS, but hope to bring it to you soon as well!
That’s really a great step forward taken for 2D games. It’s true that most emulators on mobile devices do use an emulated gamepad. But whatsoever, this will make mobile support for simple 2D games more intuitive than ever.
Anyway, the focus-navigation feature also looks pretty good. It’s true that navigating in the UI with a controller as for now is pretty hard, so cheers!
However, how are developers supposed to provide seamless gamepad support when UserInputService:GetSupportedGamepadKeyCodes() throws an error when used on a mobile?
I did make a bug report but it has sadly not been resolved yet.
I hope it is resolved soon since we have to wrap it in a pcall() and not show keycode hints for mobile players, making it hard for mobile players using a gamepad to actually use the gamepad keybindings
This library is useful when providing additional controls for console, but you have to really watch out not to conflict with the native controls that are already implemented.
If there’s an extraordinary action I want players on console to have access to, I will use this library and maybe even make that one special mobile player happy, using his own custom keyboard on Android…
This is an absolute life saver. I had implemented all of this myself in order to support traditional gamepad navigation, but it was a nightmare. Very grateful to have an official solution from Roblox!
This is great news, I’ve been needing something like this! Once this makes it’s way to Wally (thank you @grilme99 ) I’ll start using it in my current project!!
Could be talking about the navigation of the UI? When I used a gamepad a while ago I had to tap around the UI but inside of a game it worked just fine.
my guess would be an invisible frame that has x,y scale of 1 + a couple pixels of offset, with a UIStroke, UICorner and UIGradient (white fading to gray) inside it with the UIGradient’s Rotation on an infinite tween or a loop.
edit: just to clarify, the UIGradient needs to be in the UIStroke, not the frame.
if we have gamepad support on mobile. we are one step closer to having roblox on the switch! i think the switch 2 could be capable of roblox with the bigger screen
How could you leverage the Focus Navigation library to optimize user flow and create intuitive UI interactions across multiple input devices, particularly taking advantage of the newly enabled gamepad support on mobile and keyboard navigation for Android?
The Gamepad and Keyboard Support for the most recent title Neptuna has been working on will be a massive help considering our target audience may have experience with third-party titles not on the ROBLOX platform!