Focus boundary SG tree example

This app validates FocusBoundary focus enter and leave behavior when a TypeScript focus panel is inside a mixed BrightScript and TypeScript SceneGraph tree.

Purpose

Unlike the pure TypeScript focus-boundary examples, this app uses a BrightScript scene (MixedFocusScene) that owns the tree and hands key events and focus activation to a TypeScript anchor node (TsMiddlePanel, extending FocusBoundaryBase). The example shows that the TypeScript-driven focus model integrates with native SceneGraph focus: focus enters and leaves the TypeScript panel, and key events that the panel does not handle bubble back to BrightScript.

Summary

This example covers the following behaviors:

  • BrightScript and TypeScript focus handoff through the keyEvent and focusActive inputs and the handledKeys and focusPath outputs
  • A flat 2×2 grid (navigationMap, without nesting) beside nested FocusBoundary components (Sidebar and Content)
  • rememberLastFocus and onFocusGained and onFocusLost cascades across nested boundaries
  • Edge keys (up and down) left unclaimed so they bubble to BrightScript for navigation between components
  • The setFocusPath function of RootFocusBoundary, which reports the active focus path

Development

To build, test, and lint the example, run these commands:

npx rk dev          # Build + deploy to Roku device
pnpm test           # Run tests
pnpm run lint       # Lint sources

Did this page help you?