use-spatial-navigation
SKILL.md
Use Spatial Navigation
Overview
Deliver practical, minimal, production-ready integration guidance for spatial navigation in React, Vue 3, or framework-agnostic environments.
Workflow
- Identify the integration target first:
- React: use
@spatial-navigation/react. - Vue 3: use
@spatial-navigation/vue. - Framework-agnostic/runtime-level: use
@spatial-navigation/runtime(optionally with@spatial-navigation/dom).
- React: use
- Identify the user goal:
- New setup: provide a minimal working skeleton (Provider + Scope + Focusable).
- Navigation behavior: define
neighborsand/orindex, and assigntabLevelwhere needed. - Input behavior: verify keyboard/gamepad sources and
inputModeupdates. - Focus issues: verify scope activation, default focus, history restore, and disabled state.
- Keep output strategy consistent:
- Provide a minimal solution first, then optional advanced refinements.
- Depend on public package APIs only.
- Never depend on repository-internal file paths or private implementation details.
- Keep node IDs stable, unique, and predictable.
Implementation Rules
- Ensure every focusable node belongs to an explicit
scopeId. - Ensure each active scope has at least one focusable node.
- Prefer explicit
neighborslinks for deterministic movement. - Use
index: { row, col, order }for grid/rail fallback behavior. - For shoulder-button tab switching, assign
tabLevel: 'primary' | 'secondary'to target nodes. - In
ConsoleUIProvider, enable keyboard/gamepad input sources by default unless user requirements say otherwise. - For overlays/modals, use nested
FocusScopewithtrapandrestoreFocus. - For visibility issues, verify node-to-element registration and
ensureFocusedNodeVisiblewiring.
Debug Checklist
- Focus does not move:
- Verify
activeScopeIdmatches nodescopeId. - Verify target nodes are not
disabled. - Verify
neighborsonly point to existing IDs.
- Verify
TAB_NAVdoes not work:- Verify nodes have the expected
tabLevel. - Verify dispatched action shape:
{ type: 'TAB_NAV', level, dir }.
- Verify nodes have the expected
- Gamepad does not work:
- Verify gamepad input source is enabled.
- Verify input polling/listener lifecycle is not prematurely cleaned up.
- Focus style is wrong:
- React: verify
focusablePropsare applied. - Vue: verify
focusableAttrsmap totabindexanddata-focused.
- React: verify
References
- Generic setup templates and action patterns:
references/integration-recipes.md - Package responsibilities and action model:
references/package-map.md
Weekly Installs
2
Repository
xuasir/skillsFirst Seen
Feb 25, 2026
Security Audits
Installed on
trae2
gemini-cli2
github-copilot2
codex2
kimi-cli2
cursor2