Files
romm/frontend
Stu Anderson 3c85052025 fix(input): show the focus ring when arrow keys move focus in Firefox (#5066)
* fix(input): show the focus ring when arrow keys move focus in Firefox

After a mouse click, Firefox treats a script-driven focus() as mouse focus and
skips :focus-visible, so the tile an arrow key moved to had no ring. Pass
focusVisible: true from the three arrow-key focus sites (useSpatialNav,
useGridNav, useWrapGridNav). Browsers without the option ignore it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(input): show the focus ring on menu and calendar arrow moves in Firefox

Apply the same focusVisible hint to RMenu (arrow keys between items, and its
keyboard/pad initial focus) and RDateField (arrow, Home and End between days).
The calendar's focus on open stays with the browser, so a mouse open shows no
ring.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* remove comments

* test(input): cover the focus ring on grid, menu and calendar moves

Addresses Greptile review on #5066: drops a comment that restated the
modality guard, and asserts focusVisible on the useGridNav,
useWrapGridNav, RMenu arrow and RDateField arrow/End paths.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* pr-ready step 2 (code-review): always request focusVisible on calendar days

The day outline is gated on input modality, so the ring flag on
focusDayCell was redundant and relied on nextTick resolving to
undefined. Tighten the RMenu and RDateField focus-ring assertions to
the element that should receive focus.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* pr-ready step 3 (simplify): fold the focus-ring tests into existing ones

Merge the RMenu initial-focus ring check into the initialFocus test,
let mountMenu take props and panel content instead of repeating the
activator template, and cover RDateField's single focusDayCell path
with one test for opening and one arrow move.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(input): route v2 focus through a modality-aware helper

- focusFromInput asks for focusVisible only on key and pad input, and
  every v2 focus() call now goes through it. ESLint flags a bare
  .focus() under src/v2.
- useInputModality counts Home, End, PageUp and PageDown as keyboard
  input and listens in the capture phase, so navigation handlers see
  the new modality. useGamepad switches to pad before dispatching its
  synthetic key for the same reason.
- RDateField: PageUp/PageDown move the cursor and focus with the view,
  and the cursor stops at min/max instead of landing on a disabled day.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-03 09:44:24 -04:00
..
…
…