AgentSkillsCN

spatial-navigation-engineering

为电视应用设计并实现10英尺距离下可读的资讯架构,涵盖浏览、详情与播放流程。在为React TV应用定义适合远距离阅读的布局、尽量减少操作步骤,并在React应用中强化焦点引导的可用性时使用此功能。

SKILL.md
--- frontmatter
name: spatial-navigation-engineering
description: Engineer deterministic D-pad navigation for TV apps. Use when implementing or debugging focus graphs across rails, grids, tabs, dialogs, overlays, and deep-linked entry states for Samsung, LG, Hisense, Xbox, or PS5 targets.

Spatial Navigation Engineering

Overview

Define explicit, testable focus behavior for every navigable screen state. Prefer deterministic focus maps over implicit DOM order.

Workflow

  1. Map each screen into focus zones (hero, rail, tab row, metadata panel, CTA cluster).
  2. Declare directional transitions per focusable node: up, down, left, right.
  3. Add wrap rules only where product requires carousel behavior.
  4. Implement overlay focus traps with explicit escape targets.
  5. Define fallback focus recovery when the previous node disappears after refresh or entitlement changes.

Implementation Rules

  • Entering any route: place focus on the route's primary actionable element.
  • Opening a modal/overlay: trap focus inside; Back closes overlay first.
  • Closing overlay: restore focus to launch origin when still visible.
  • Missing origin: restore to a stable route-level default target.
  • Dynamic rails: keep logical index continuity when items insert/remove.

Validation Checklist

  • No dead-end nodes in any direction.
  • No accidental wrap between unrelated zones.
  • Focus indicator remains visible and high-contrast on all backgrounds.
  • Deep links land on meaningful focus, not page chrome.
  • Back never strands user in non-focusable state.

References

  • Use references/focus-map-template.md for map schema and screen-by-screen checklists.