@lattice-ui/focus
v0.3.2
Published
Focus and directional navigation primitives for Roblox UI.
Readme
@lattice-ui/focus
Focus and directional navigation primitives for Roblox UI.
Current status
RovingFocusGroupandRovingFocusItemprovide arrow/Home/End navigation across registered selectable items.FocusScopecan trapGuiService.SelectedObjectand restore captured focus on scope teardown.
FocusScope behavior
activedefaults totrue.asChildkeeps caller tree structure; without it,FocusScoperenders a transparent full-size frame wrapper.- When
trappedis true, outside selections are redirected to:- last focused selectable object inside the scope, then
- first selectable descendant inside the scope.
- Nested trapped scopes use stack order; only the top-most active trapped scope redirects focus.
- When
restoreFocusis true, captured focus is restored on unmount/deactivation if the target is still valid.
Known limits
- Trap and restore currently use
GuiService.SelectedObjectonly. - This phase does not manage
NextSelection*graph rewrites.
