Skip to content

fix(tvOS): restore focus after closing sidebar - #570

Draft
thiagobrez wants to merge 1 commit into
mainfrom
codex/issue-501-tvos-focus-restore
Draft

fix(tvOS): restore focus after closing sidebar#570
thiagobrez wants to merge 1 commit into
mainfrom
codex/issue-501-tvos-focus-restore

Conversation

@thiagobrez

Copy link
Copy Markdown
Collaborator

Closes #501.

Summary

  • teach the tvOS RepresentableView wrapper to remember its most recently focused descendant and expose it through preferredFocusEnvironments
  • reject detached, non-focusable, non-descendant, or Fabric-recycled views whose React tag has changed
  • retain the existing default focus path until a descendant has actually been focused
  • add a patch changeset and CI checks that lint/typecheck the issue repro and compile the tvOS-only Swift path at the supported tvOS 15.1 deployment target

The implementation is inside #if os(tvOS). iOS, macOS, visionOS, and Android keep the existing wrapper and public APIs/defaults are unchanged.

Validation

  • reproduced the issue on tvOS 26.5 with React 19.2.3, react-native-tvos 0.83.1-0, Hermes, and the New Architecture
  • rebuilt and ran the final packed library with Xcode 26.6 (17F113), targeting tvOS 15.1
  • verified focus restoration to Button 8 over repeated sidebar cycles and to Button 15 after scrolling
  • verified a new route starts at Button 0 rather than receiving stale focus, and a fresh install retains the original default entry behavior
  • passed yarn lint, yarn typecheck, yarn build, yarn build:ios, and yarn build:android
  • passed direct Swift typechecks for tvOS 15.1, iOS 14, macOS 11, and visionOS 1
  • passed repro TypeScript/ESLint, workflow YAML, Prettier, changeset, and diff checks

yarn test still exits before executing tests because @bottom-tabs/react-navigation has no test files; this is unchanged from main, and the repository has no test CI job or native XCTest target.

Evidence

Adversarial review

Exactly one synchronous Fable High review covered the full uncommitted diff, including untracked files, and returned six concrete findings. The required one-shot Codex remediation then addressed the recycled-view guard, tvOS CI coverage, release metadata, repro validation/evidence duplication, and Swift style. The Paper-only dynamic-child finding was disproven because old-architecture support was removed in 4b4e781; changing unsupported Paper identity behavior would broaden the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tvOS] Focus not restoring with sidebarAdaptable

1 participant