Files
gui/plans/focusable-remove.md
T
zeekayandHanzo Dev 69c6e860d7 transplant onto tamagui v2.6.0, brand as a re-runnable transform
This repo could never sync. There was NO merge-base with tamagui — 372 commits
here against 15,791 there, unrelated histories — because it began as a
copy-paste rebrand with a flattened layout. Every "sync" since was a hand
re-application that drifted, which is why the tree sat on 7.3.1 while upstream
shipped fixes we then rediscovered by hand.

This commit's PARENT IS TAMAGUI. A future sync is `git merge tama/main` then
`node scripts/rebrand.mjs` — a real merge, because the history is now shared.

174 packages: 166 upstream, our 8 restored (chrome, shell, telemetry, recipes,
get, font-geist-{sans,mono}, @hanzo/booker), bento-get gained. 170/170 build.

Our patches to files UPSTREAM ALSO OWNS are carried, which the package-level
delta missed and which was where the value actually was:
  - useMedia's server snapshot (`initState ?? getMedia()`). Upstream still
    returns undefined there, so every Tamagui Dialog kills a prerender — the
    exact crash hanzo.app spent a day on.
  - data-slot on web host nodes, absent upstream entirely.
Both applied ONTO upstream's newer files (it rewrote useMedia +150/-63 and
createComponent +160/-55), marked `PATCH (ours, carried across the transplant)`.

Seven traps are encoded in scripts/rebrand.mjs, each found by a gate:
skip itself and lockfiles; special-case the double-branded names in BOTH scoped
and bare form; map path strings, not just paths; drop a level for the flattened
group; check disk rather than a stale index.

Rust build artifacts are NOT committed. An earlier draft of this commit swept
apps/desktop/src-tauri/target/debug in via `git add -A` — 3,859 files including
a 272MB .a, over GitHub's 100MB cap, so the push could never have landed. They
are gitignored now.

Co-Authored-By: Hanzo Dev <[email protected]>
2026-07-30 18:25:06 -07:00

3.2 KiB

Remove focusable prop in favor of tabIndex

Summary

Remove the React Native focusable prop from Gui v2 in favor of the web-standard tabIndex. This simplifies the API and aligns with web conventions.

Semantic Mapping

  • focusable={true} → tabIndex={0}
  • focusable={false} → tabIndex={-1}
  • focusable={!disabled} → tabIndex={disabled ? -1 : 0}

Files to Change

Core (remove type + forwarding)

  1. pkgs/core/web/src/interfaces/GuiComponentEvents.tsx:8

    • Remove focusable?: any from type
  2. pkgs/core/react-native-web-internals/src/modules/forwardedProps/index.tsx:68

    • Remove focusable: true from forwarded props
  3. pkgs/core/react-native-web-internals/src/modules/createDOMProps/index.tsx

    • Remove focusable handling (lines 110, 310-339)
    • Or just leave it - once removed from forwardedProps it won't reach here
  4. pkgs/core/web/src/createComponent.tsx:1295

    • Remove focusable: viewProps.focusable ?? true
  5. pkgs/core/core/src/createOptimizedView.native.tsx:40,117-119

    • Keep tabIndex → focusable conversion for native (RN still uses focusable)
    • Just remove accepting focusable as input prop

UI Components (change focusable → tabIndex)

  1. pkgs/ui/button/src/v1/Button.tsx

    • Line 84: focusable: true → tabIndex: 0
    • Line 295: remove focusable: undefined
  2. pkgs/ui/toggle-group/src/ToggleGroup.tsx:83

    • focusable={!disabled} → tabIndex={disabled ? -1 : 0}
  3. pkgs/ui/toast/src/ToastImpl.tsx:34

    • focusable: true → tabIndex: 0
  4. pkgs/ui/toast/src/ToastViewport.tsx:293

    • focusable={context.toastCount > 0} → tabIndex={context.toastCount > 0 ? 0 : -1}
  5. pkgs/ui/radio-headless/src/useRadioGroup.tsx:235

    • focusable: !isDisabled → tabIndex: isDisabled ? -1 : 0
  6. pkgs/ui/create-menu/src/createBaseMenu.tsx:1039

    • focusable={!disabled} → tabIndex={disabled ? -1 : 0}
  7. pkgs/ui/tabs/src/createTabs.tsx:142

    • focusable={!disabled} → tabIndex={disabled ? -1 : 0}
  8. pkgs/ui/input/src/shared.tsx:20

    • focusable: true → tabIndex: 0
  9. pkgs/ui/roving-focus/src/RovingFocusGroup.tsx:172,237

    • Line 172: focusable={focusable} → tabIndex={focusable ? 0 : -1}
    • Line 237: Update ItemData type if needed

Tests

  1. pkgs/core/react-native-web-internals/src/modules/createDOMProps/__tests__/index-test.tsx

    • Update or remove focusable tests
  2. pkgs/core/core-test/webAlignment.web.test.tsx:213-220

    • Update test expectations
  3. pkgs/core/core-test/webAlignment.native.test.tsx:188-194

    • Update test expectations
  4. pkgs/compiler/static-tests/tests/webAlignment.web.test.tsx:221

    • Update test

Out of Scope (separate package)

  • pkgs/react-native-web-lite - This is a separate RN-web compatibility layer, keep focusable there

Difficulty

Medium - Straightforward changes but spread across ~15 files. Main risk is missing a usage somewhere.

Testing

  1. Run yarn test in affected packages
  2. Check kitchen-sink for focus behavior
  3. Verify tabIndex works correctly on web and maps to focusable on native