![]() ![]() For more information or best practices, visit the GetStringForKe圜ode section on the UserInputService docs page. ![]() Don’t leave users guessing how to do things - show them how to perform an action either in the context of which that action is performed, or in an easily-accessible menu.If you allow users to close modals or menus by pressing B (recommended by the Xbox Featured Experience Guidelines), allowing keyboard users to do the same thing by pressing Backspace. If you find any gaps in your experience / things you can’t do, please file a bug here on the DevForum - we’ll take a look at it.ĭevelopers - there is very little difference between supporting controllers, and supporting keyboard navigation.įor any shortcuts you’ve added for gamepad controllers, consider adding one for keyboard users. Once an element is selected, use the arrow keys ( ▲ ▼ ◄ ►) or W A S D to navigate between elements, and Enter to activate. Players should now be able to navigate UI in experiences using only your keyboard. ProximityPrompts with any of these keys as the KeyboardKey) will be completely unaffected. emotes menu), and allows you as the developer to override this functionality if you choose to by binding an action at a higher priority with BindActionAtPriority. This is consistent with the implementation of other keybinds we have added (e.g. You will note via the code blocks that the action for scrolling always passes input, while the toggle UI selection action sinks input when an event occurs (an element is selected or deselected). ScrollingFrame.CanvasPosition = Vector2.new(x, y)ĬontextActionService:BindAction("ScrollSelectedElement", ScrollSelectedElement, false, Enum.Ke圜ode.PageUp, Enum.Ke圜ode.PageDown, Enum.Ke圜ode.Home, Enum.Ke圜ode.End) X = math.max(0, math.min(x + scrollDistance, )) Y = math.max(0, math.min(y + scrollDistance, ))Įlseif inputObject.Ke圜ode = Enum.Ke圜ode.Home or inputObject.Ke圜ode = Enum.Ke圜ode.End If inputObject.Ke圜ode = Enum.Ke圜ode.PageUp or inputObject.Ke圜ode = Enum.Ke圜ode.PageDown then If inputObject.Ke圜ode = Enum.Ke圜ode.PageUp or inputObject.Ke圜ode = Enum.Ke圜ode.Home thenĮlseif inputObject.Ke圜ode = Enum.Ke圜ode.PageDown or inputObject.Ke圜ode = Enum.Ke圜ode.End then If selected object is not a scrolling frame, or a descendant of one, ignore Local scrollingFrameAncestor = selectedObject:FindFirstAncestorOfClass("ScrollingFrame") If selectedObject.ClassName = "ScrollingFrame" then Local selectedObject = GuiService.SelectedObject local function ScrollSelectedElement(actionName, inputState, inputObject) The code is available below for reference. This is equivalent to a controller’s joystick behavior when focused on a scrolling frame. Fn+ ◄ / Fn+ ► on keyboards without dedicated keys.Fn+ ▲ / Fn+ ▼ on keyboards without dedicated keys.In addition, PageUp, PageDown, Home, and End will trigger scrolling if your SelectedObject is a ScrollingFrame, or a descendant of one. This addition is now shown in the Controls section of the In-Game Menu as UI Selection Toggle under Misc. There is a selected object, unselect itĬontextActionService:BindAction("EnableKeyboardUINavigation", EnableKeyboardNavigation, false, Enum.Ke圜ode.BackSlash) If not GuiService.AutoSelectGuiEnabled then local function EnableKeyboardNavigation(actionName, inputState, inputObject) ![]() We’ve provided the logic for this in the following code block for reference. ![]() This is equivalent to the behavior of a controller’s Select button, and it also respects AutoSelectGuiEnabled. If you have one selected, it will unselect it. If you do not have an element selected, it selects an element in the PlayerGui. The \ ( Backslash) key will now toggle UI Selection ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |