# Radix UI roving-focus extraction

Upstream: https://github.com/radix-ui/primitives

Fixed commit: `310707ffcabb562917373dc3717f28a29ec6d156`.
Original source: [packages/react/roving-focus/src/roving-focus-group.tsx](https://github.com/radix-ui/primitives/blob/310707ffcabb562917373dc3717f28a29ec6d156/packages/react/roving-focus/src/roving-focus-group.tsx).
Original licence: [LICENSE](https://github.com/radix-ui/primitives/blob/310707ffcabb562917373dc3717f28a29ec6d156/LICENSE), MIT, Copyright (c) 2022 WorkOS.

`upstream-roving-focus-group.tsx` and `LICENSE` are complete, unmodified
snapshots of those files. They are provenance, not a React runtime dependency.

## Actual runtime reuse

`navigation.mjs` adapts these small, dependency-free parts of that source:

- The key-to-focus-intent map, `getDirectionAwareKey` and `getFocusIntent`.
- Candidate reversal and slicing from `RovingFocusGroupItem`'s keydown handler.
- `focusFirst`'s stop-on-focus-success behaviour.

Modified by EssayPilot on **2026-10-02**: remove TypeScript and enum property
access, omit PageUp/PageDown so page scrolling remains native, keep the upstream
non-wrapping behaviour, inject a document and return the focused candidate.
The app calls focus synchronously because it has no React batched-state handler;
it does not import React, Radix contexts/collections or the original JSX control.

The surrounding `../../roving-controls.mjs` is original EssayPilot integration:
event delegation, exact existing arsenal groups, eligibility checks, preservation
and restoration of tabindex, and focus memory across explicit refresh/repaint.
Existing buttons retain their aria-pressed and role semantics. Arrow keys move
focus only; the app still receives native Enter/Space activation.
